Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
datatype larger than 255?
20 posts, Page 1 of 2
1
2
»»
datatype larger than 255?
Rate Topic
Display Mode
Topic Options
Author
Message
briancampbellmcad
briancampbellmcad
Posted Wednesday, January 16, 2013 7:57 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, May 13, 2013 12:09 PM
Points: 101,
Visits: 246
I have to import some data that has text fields that can run from 300-400 characters... is there a datatype I can change my textfield to that will allow for that?
Post #1407844
GSquared
GSquared
Posted Wednesday, January 16, 2013 8:07 AM
SSCoach
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 1:55 PM
Points: 15,442,
Visits: 9,571
Normal varchar can go up to 8000 characters if you define it that way. Varchar(max) can go up to 2 Gig (approximately 2 billion characters).
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1407855
anthony.green
anthony.green
Posted Wednesday, January 16, 2013 8:07 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
varchar(400), nvarchar(400) depending on if it is unicode or non-unicode data.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1407856
Adi Cohn-120898
Adi Cohn-120898
Posted Wednesday, January 16, 2013 8:10 AM
SSCrazy
Group: General Forum Members
Last Login: 2 days ago @ 9:50 AM
Points: 2,019,
Visits: 4,923
You can use varchar(XXXX) or char(XXXX). Instead of XXXX you can specify a number up to 8000. The number represents the number of characters that you'll have. You can also use varchar(max) or char(max) to work with much bigger strings. I suggest that you'll read a bit about SQL Server data types -
http://msdn.microsoft.com/en-us/library/ms187752.aspx
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #1407861
briancampbellmcad
briancampbellmcad
Posted Wednesday, January 16, 2013 8:28 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, May 13, 2013 12:09 PM
Points: 101,
Visits: 246
The reason I was asking was I was loading about 20,000 records and kept getting an error popup "String or binary data would be truncated".... looked through the data and found no fields actually that exceeded the 255. So still searching....
Post #1407874
GSquared
GSquared
Posted Wednesday, January 16, 2013 8:36 AM
SSCoach
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 1:55 PM
Points: 15,442,
Visits: 9,571
Are you using the Import Wizard in Management Studio? Or an SSIS package? Or something else?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1407878
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Wednesday, January 16, 2013 8:44 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 1:14 AM
Points: 31,433,
Visits: 13,746
When you looked through the data, do you mean in SSMS? Or did you query something like LEN()?
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1407885
briancampbellmcad
briancampbellmcad
Posted Wednesday, January 16, 2013 8:45 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, May 13, 2013 12:09 PM
Points: 101,
Visits: 246
Actually I'm using SQL Server Express so I'm pasting them from copying the data from a .csv file. Is there another way with SQL Server Express?
Post #1407886
Sean Lange
Sean Lange
Posted Wednesday, January 16, 2013 8:55 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 2:33 PM
Points: 8,620,
Visits: 8,261
briancampbellmcad (1/16/2013)
Actually I'm using SQL Server Express so I'm pasting them from copying the data from a .csv file. Is there another way with SQL Server Express?
Yes as Steve suggested use the LEN function.
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1407895
briancampbellmcad
briancampbellmcad
Posted Wednesday, January 16, 2013 9:07 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Monday, May 13, 2013 12:09 PM
Points: 101,
Visits: 246
After I pasted the errors began. I looked back at my data in my .csv and found no reason that all the records should not commit. Not sure how to use the LEN function in this case although I'm familiar with it "SELECT LEN(Address) as LengthOfAddress FROM Persons". I'd would be looking at the data that commited rather than the one's that failed (?). I also have access only to SSMS in SQL Server Express so my options are limited.
Post #1407907
« Prev Topic
|
Next Topic »
20 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.