Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Tuesday, March 20, 2012

Best practices for field sizes

Can any one direct me to sources for best practices of field types and sizes
to use for commonly used information such as address, names, city, business
names ...

Thanks, BrianThe maximums you need actually vary depending on country, industry sector,
etc. There's no perfect number ofr any field, so you'll ahve to figure it out
on a case-by-case basis.

Most databases including Access don't usually use up space for all the
characters in a string, just the ones that are actually used. Because of
this, the only reason for ever using a field size smaller than the maximum of
255 is as a data entry sanity check or to discourage people form adding extra
information to the field that actually belongs elsewhere. Sometimes, it's
better to do that check in the application forms, and warn the user without
preventing them from entering the longer value if they insist it's right.

You can usually get a good idea how big a field should be by taking the
biggest value you can find, and multiplying by about 1.66.

On Sun, 27 Feb 2005 20:17:10 -0600, "Brian" <brianh@.advantexmail.net> wrote:

>Can any one direct me to sources for best practices of field types and sizes
>to use for commonly used information such as address, names, city, business
>names ...
>Thanks, Brian|||"Brian" <brianh@.advantexmail.net> wrote in message
news:1124vsnj59p5q9a@.corp.supernews.com...
> Can any one direct me to sources for best practices of field types and
> sizes
> to use for commonly used information such as address, names, city,
> business
> names ...
> Thanks, Brian

If you intend to use the addresses for mailings - I would refer to the USPS
guidelines and standards, and work backwards to set your address fields.

As for names, I try and keep them fairly short (40 chars) and seperate them
into parts (Title, First, Middle, Last and Suffix), but thats just me. Even
if you have big fields, it won't all get displayed in a window envelope.|||Go to your industry standards.

For example, the USPS uses 35 characrter per address line to fit into a
5-line 3.5 inch mailing label.

Friday, February 24, 2012

Best approach to sending field names dynamically

Hi,

I have a C# web app that searches my database table using the
following search parameters

Search string, criteria (< =) and the field you want to perform your
search on. My understanding is that stored procedure is the way to go.
What's the best way of doing this using stored procedures. Can I
define a placeholder for the field name?

Ex.
SELECT field1, field2... FROM Table WHERE field1='value1' where field1
and value1 are both sent from code.

If it's not possible then what is the best way to approach this
problem? I see so many searches like that on the internet. I can only
do them with inline SQL and not stored procedure.

Thank you
Maz.(maflatoun@.gmail.com) writes:

Quote:

Originally Posted by

I have a C# web app that searches my database table using the
following search parameters
>
Search string, criteria (< =) and the field you want to perform your
search on. My understanding is that stored procedure is the way to go.
What's the best way of doing this using stored procedures. Can I
define a placeholder for the field name?
>
Ex.
SELECT field1, field2... FROM Table WHERE field1='value1' where field1
and value1 are both sent from code.
>
If it's not possible then what is the best way to approach this
problem? I see so many searches like that on the internet. I can only
do them with inline SQL and not stored procedure.


Yes, these sort of searches are not very easy to do with static SQL.
I have an article on my web site that discusses this topic in detail:
http://www.sommarskog.se/dyn-search.html.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Sunday, February 12, 2012

Beginer Problem: Is there any way to create the destination file at runtime?

I have to generate flat files from SQL Server tables. Its a backup package for few tables which will be run daily. I want the names of the destination flat files to be automatically generated at run time.

I created an expression for the Flat file destination connection and appended the date and the time to the flat file name. For today my file name is 'table02-12-2007.txt'. for tomorrow it should be 'table02-13-2007'. When I evaluate the expression it shows the correct value.

But when i run the package, I receive an error indicating - Destination file is not found. Error is because the destination file is not present at runtime and I was hoping that the package will be create the file on the fly.

Is there any way to create the destination file at runtime? Or Am I missing a step?

Any help will be greatly appreciated.

Thanks

Hi Don,

You probably need to set the DelayValidation property for the package to True. Do this by clicking on the Control Flow and hitting F4 for properties.

One issue here is the destination file for the Flat File Connection Manager does not exist - by design. You have to configure the package so it will stop looking for it - which is what occurs during validation.

Hope this helps,
Andy

|||

Thanks Andy for your quick response.

I changed the delay validation but that didnt work. There were spaces in destination path "C:\My Folder\My Files" which was not allowed.

Is there any way we can have spaces in the path or connection string for flat file?

Thanks

|||

Hi Don,

I believe you can enclose the file name in quotes.

Hope this helps,
Andy

Beginer Problem

I have to generate flat files from SQL Server tables. Its a backup package for few tables which will be run daily. I want the names of the destination flat files to be automatically generated at run time.

I created an expression for the Flat file destination connection and appended the date and the time to the flat file name. For today my file name is 'table02-12-2007.txt'. for tomorrow it should be 'table02-13-2007'. When I evaluate the expression it shows the correct value.

But when i run the package, I receive an error indicating - Destination file is not found. Error is because the destination file is not present at runtime and I was hoping that the package will be create the file on the fly.

Is there any way to create the destination file at runtime? Or Am I missing a step?

Any help will be greatly appreciated.

Thanks

Hi Don,

You probably need to set the DelayValidation property for the package to True. Do this by clicking on the Control Flow and hitting F4 for properties.

One issue here is the destination file for the Flat File Connection Manager does not exist - by design. You have to configure the package so it will stop looking for it - which is what occurs during validation.

Hope this helps,
Andy

|||

Thanks Andy for your quick response.

I changed the delay validation but that didnt work. There were spaces in destination path "C:\My Folder\My Files" which was not allowed.

Is there any way we can have spaces in the path or connection string for flat file?

Thanks

|||

Hi Don,

I believe you can enclose the file name in quotes.

Hope this helps,
Andy