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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 User Defined Datatype Error

Author  Topic 

kioteh
Starting Member

16 Posts

Posted - 2010-03-17 : 17:40:37
I get the following message whenever I try to insert into a table that has a user defined datatype for a couple of the columns.

Msg 402, Level 16, State 1, Line 4
The data types void type and varchar are incompatible in the greater than or equal to operator.

The UDT is a simple varchar(7) and the code that does the insert has been used for years. This came up during a migration from SQL 2000 to SQL 2008. The funny thing is the code is a simple insert statement with no boolean type code in it.


insert DBName..TableName (Col1, Col2, Col3)
select substring(Row,1,6), substring(Row,7,6), substring(Row,13,6)
from DBName..TableName2

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-17 : 18:59:42
Can you get rid of the UDT and instead use varchar(7)?

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

kioteh
Starting Member

16 Posts

Posted - 2010-03-18 : 10:38:50
I can in the sense that if I do, it works fine, but I can't as a permanent solution.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-18 : 11:34:04
I'd suggest contacting Microsoft to see if there is a solution for this. I assume some feature was removed.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-18 : 13:37:24
Tried dropping and recreating the Type? I suspect that SQL 2008 is looking for a CLR assembly. Dropping and recreating will resolve if that's the case.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-18 : 13:55:20
by the way...I just tested creating a type in sql 2000, then restored the db to sql 2008. i didn't have this problem, either in 80 or 100 compatibility mode.

still suggest dropping and recreating type -- using DROP TYPE / CREATE TYPE syntax (not sp_addtype)

by the way, have you applied SP1 to your SQL 2008 installation?
Go to Top of Page

kioteh
Starting Member

16 Posts

Posted - 2010-03-19 : 17:31:37
Russell, that's a good idea, I'll try that and report back.
Go to Top of Page
   

- Advertisement -