Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server 2000 problem in inserting varchar value into a varchar colu 1

Status
Not open for further replies.

tempo1

Programmer
Feb 20, 2007
118
hi everyone,
i created a table with a varchar column and when i tried to insert value into it as follows:
Code:
declare @xxx table
(
aaa varchar
)
 
INSERT INTO @xxx
(    
aaa    
)   
SELECT   
cast(333 as varchar)
i recieved the following error message:
String or binary data would be truncated.
The statement has been terminated.
can anyone tell me why ?
thanks.
 
Try...

Code:
declare @xxx table
(
aaa varchar[!](30)[/!]
)

You should always specify the size of varchar columns.

-George

"the screen with the little boxes in the window." - Moron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top