Hi,
I am trying to insert into a table (tableB)
with columns:
col1 varchar(15) and code varchar(8000)
Col1 is a simple copy from tableA while
col2 is a field created by a concatentaiont of values
from tableA.
The insert statement looks like
BEGIN CODE:
insert into tableB
select col1,
case
when col2=1
then '002'
else ''
end
+
case
when col3=1
then '003'
else ''
end etc...
as code
from tableA
END CODE
The case statement I created as 2 strings (@str2,@str3)
Both variables are varchar(8000). (The number of case
statements is considerable)
My exec statement looks like
exec('Insert into tableB select top 100 col1,'+@str2+@str3+' as code from tableA')
I get the following error:
Server: Msg 248, Level 16, State 1, Line 1
The conversion of the varchar value '008022029053080099100135' overflowed an int column. Maximum integer value exceeded.
The statement has been terminated.
Why? Nothing I have is defined as an int. I checked
the table and there are no int columns. Why is this happening?
Thanks a mil'
ds
I am trying to insert into a table (tableB)
with columns:
col1 varchar(15) and code varchar(8000)
Col1 is a simple copy from tableA while
col2 is a field created by a concatentaiont of values
from tableA.
The insert statement looks like
BEGIN CODE:
insert into tableB
select col1,
case
when col2=1
then '002'
else ''
end
+
case
when col3=1
then '003'
else ''
end etc...
as code
from tableA
END CODE
The case statement I created as 2 strings (@str2,@str3)
Both variables are varchar(8000). (The number of case
statements is considerable)
My exec statement looks like
exec('Insert into tableB select top 100 col1,'+@str2+@str3+' as code from tableA')
I get the following error:
Server: Msg 248, Level 16, State 1, Line 1
The conversion of the varchar value '008022029053080099100135' overflowed an int column. Maximum integer value exceeded.
The statement has been terminated.
Why? Nothing I have is defined as an int. I checked
the table and there are no int columns. Why is this happening?
Thanks a mil'
ds