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
 8000 max size ? in SQL 2000

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-05-27 : 03:54:06
Hi
I have a BULK INSERT task to do, inserting
contents of a file per row.. (not lines total contents of text files)
but it seems 8000 is the max size of a field in SQL 2000 ?

is this the case ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-27 : 03:56:22
If its varchar 8000 is max size. But you can use text fields if you really want to store really long character data.
Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-05-27 : 04:25:03
[CODE]
ok .. so something like CREATE TABLE tmp_table (line text(80000))
[/CODE]
when im creating the temp table ?
Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-05-27 : 04:26:55
Server: Msg 131, Level 15, State 2, Line 1
The size (80000) given to the column 'line' exceeds the maximum allowed for any data type (8000).

No doesn't work either .. but what about just getting the 1st 8000 chars ?

is there an argument with BULK INSERT to use to limit that ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-27 : 04:35:35
quote:
Originally posted by pazzy11

Server: Msg 131, Level 15, State 2, Line 1
The size (80000) given to the column 'line' exceeds the maximum allowed for any data type (8000).

No doesn't work either .. but what about just getting the 1st 8000 chars ?

is there an argument with BULK INSERT to use to limit that ?



CREATE TABLE tmp_table (line text) is enough
Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-05-27 : 08:17:25
OK , that seems to work, how can BULK INSERT data from a file to a particlur column in the tmp table

[CODE]
CREATE TABLE tmp_table (id int,line text)

bulk INSERT tmp_table(line) FROM 'E:\shared\DOCM\e\4707621.doc'
WITH (ROWTERMINATOR = '|\eof' )
[/CODE]

Won't work and the books online isn't much help, I don't think i can specify a columm?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-27 : 10:28:44
quote:
Originally posted by pazzy11

OK , that seems to work, how can BULK INSERT data from a file to a particlur column in the tmp table

[CODE]
CREATE TABLE tmp_table (id int,line text)

bulk INSERT tmp_table(line) FROM 'E:\shared\DOCM\e\4707621.doc'
WITH (ROWTERMINATOR = '|\eof' )
[/CODE]

Won't work and the books online isn't much help, I don't think i can specify a columm?




Try with OPENROWSET function then

http://msdn.microsoft.com/en-us/library/ms190312.aspx
Go to Top of Page
   

- Advertisement -