Showing posts with label storing. Show all posts
Showing posts with label storing. Show all posts

Friday, February 24, 2012

Data Types (char, varchar, nchar, nvarchar, ...)

Could someone please help me by explaining which one is best to use and when? For example, storing the word "Corona Del Mar" - which Data Type would be suggested?

Thanks.

I would suggest Varchar(#).

ntype data types support Unicode (non-standard characters). So unless you're expecting complex input (or different languages) char, varchar, and text are what you'll typically be using.

char = fixed length string. If you create a char(10) field and enter "test" the field will actually stored "test" PLUS 6 blank spaces (4 characters in test + 6 blank spaces = 10). So when you output your field, you'll actually get "test ".

varchar = variable length string. This is the bread and butter of most databases. If you create varchar(10) and enter "test", it will store test. The limitation to this field is that it can only store up to 8,000 characters.

text = unlimited text field. Downsides: Text fields are stored OUTSIDE the database record (only a pointer is stored inside the record) so retrieving text fields is slower then retrieving a varchar record. It's also not compatible with some database commands (group etc.)

|||

Chris Pebble:

I would suggest Varchar(#).

ntype data types support Unicode (non-standard characters). So unless you're expecting complex input (or different languages) char, varchar, and text are what you'll typically be using.

char = fixed length string. If you create a char(10) field and enter "test" the field will actually stored "test" PLUS 6 blank spaces (4 characters in test + 6 blank spaces = 10). So when you output your field, you'll actually get "test ".

varchar = variable length string. This is the bread and butter of most databases. If you create varchar(10) and enter "test", it will store test. The limitation to this field is that it can only store up to 8,000 characters.

text = unlimited text field. Downsides: Text fields are stored OUTSIDE the database record (only a pointer is stored inside the record) so retrieving text fields is slower then retrieving a varchar record. It's also not compatible with some database commands (group etc.)

Thank you, that was a very good explaination.

|||

I have a list box that has a few different values "information a, information b, information c" and when any or all are chosen they are stored in my database in one column. What data type would you suggest for this? Thanks.

Sunday, February 19, 2012

Data type question

I just had some one ask me about storing PDF files in a SQL table. My
question is, what would the data type be for that column? Is the data type
TEXT the correct one for this?
Thanks to all who can help me.
Billy
"BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
>I just had some one ask me about storing PDF files in a SQL table. My
> question is, what would the data type be for that column? Is the data type
> TEXT the correct one for this?
No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
varbinary(max) (SQL 2005).
David
|||Thanks David. I was just talking with a couple co-worker this morning and
they where saying the same thing.
Billy
"David Browne" wrote:

> "BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
> news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
>
> No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
> varbinary(max) (SQL 2005).
> David
>
>

Data type question

I just had some one ask me about storing PDF files in a SQL table. My
question is, what would the data type be for that column? Is the data type
TEXT the correct one for this?
Thanks to all who can help me.
Billy"BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
>I just had some one ask me about storing PDF files in a SQL table. My
> question is, what would the data type be for that column? Is the data type
> TEXT the correct one for this?
No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
varbinary(max) (SQL 2005).
David|||Thanks David. I was just talking with a couple co-worker this morning and
they where saying the same thing.
Billy
"David Browne" wrote:

> "BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
> news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
>
> No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
> varbinary(max) (SQL 2005).
> David
>
>

Data type question

I just had some one ask me about storing PDF files in a SQL table. My
question is, what would the data type be for that column? Is the data type
TEXT the correct one for this?
Thanks to all who can help me.
Billy"BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
>I just had some one ask me about storing PDF files in a SQL table. My
> question is, what would the data type be for that column? Is the data type
> TEXT the correct one for this?
No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
varbinary(max) (SQL 2005).
David|||Thanks David. I was just talking with a couple co-worker this morning and
they where saying the same thing.
Billy
"David Browne" wrote:
> "BillyDees" <BillyDees@.discussions.microsoft.com> wrote in message
> news:F2F96802-6D94-49EC-9720-D7B16C733CBC@.microsoft.com...
> >I just had some one ask me about storing PDF files in a SQL table. My
> > question is, what would the data type be for that column? Is the data type
> > TEXT the correct one for this?
>
> No, PDF is a binary format. Store it in an IMAGE (SQL 2000) or
> varbinary(max) (SQL 2005).
> David
>
>

Data type for storing MS Word documents/large data type?

Hi all,
I am bginning to build a SQL Server database that will be used to store
documents from various users. The document types will mostly be MS Word and
MS PowerPoint. I want to know what datatype to use in the database to store
these kinds of documents.
The data will be fed to SQL Server via an ASP.Net-based website. I would
also like to know if I can just use standard ASP.Net database objects to
transfer these large amounts of data.
Many thanks for any advice or a point in the right direction.
JustinHave you done any research on the pros and cons of storing the documents in
the database, vs. using a file system? It is going to be much more
efficient to store the *paths* to the files in the database. Have a read:
http://www.aspfaq.com/2149
"Justin Little" <JustinLittle@.discussions.microsoft.com> wrote in message
news:E4D7888D-C902-4B9F-AE6A-7A8FB2F6C921@.microsoft.com...
> Hi all,
> I am bginning to build a SQL Server database that will be used to store
> documents from various users. The document types will mostly be MS Word
> and
> MS PowerPoint. I want to know what datatype to use in the database to
> store
> these kinds of documents.
> The data will be fed to SQL Server via an ASP.Net-based website. I would
> also like to know if I can just use standard ASP.Net database objects to
> transfer these large amounts of data.
> Many thanks for any advice or a point in the right direction.
> Justin
>