Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Most Compatible Data type to Insert Data Into

Author  Topic 

padgettbrian
Starting Member

23 Posts

Posted - 2012-02-21 : 12:17:19
What the most compatible data type I can use to import data from a text file to SQL Server 2005?

char, nvarchar, nvarchar(max), text ETC

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-21 : 12:40:29
You mean you don't know what type of data you are going to receive in each column? If so, either varchar or nvarchar.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-21 : 13:49:54
quote:
Originally posted by padgettbrian

What the most compatible data type I can use to import data from a text file to SQL Server 2005?

char, nvarchar, nvarchar(max), text ETC



depends on the type of values of coming in data and also maximum limit

safest option if unsure of type is to use character types like varchar,nvarchar. if you're sure maxlength will fall with 8000 limt use varchar(8000) or nvarchar(4000) if not go for BLOB types like varchar(max),nvarchar(max)
Dont use text fields as its deprecated and have lots of restrictions also for use

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

padgettbrian
Starting Member

23 Posts

Posted - 2012-02-21 : 15:53:49
Been trying the import using BizTalk and SSIS tried it with a string [DT_STR] and 300 char limit but still get this message :( I ve seen the data and there's nothing in there passed 50 char.

[Data Conversion 1 [1559]] Error: Data conversion failed while converting column "Column 328" (994) to column "Column 328" (2879). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
Go to Top of Page
   

- Advertisement -