Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a table type in Sql Server 2005

I'm trying to create a table type in sql server 2005.

Here is what my code looks like:

    CREATE TYPE NameResourceType AS TABLE
(
   ID int, 
   [Value] Varchar(256) 
)
GO

I receive the following error:

Incorrect syntax near the keyword 'AS'.

like image 561
Nikola Stjelja Avatar asked Apr 09 '10 09:04

Nikola Stjelja


2 Answers

Table alias data types & Table-Valued parameters were introduced in SQL Server 2008 so are not available in prior versions.

like image 167
Alex K. Avatar answered Jan 02 '23 04:01

Alex K.


New in SQL Server 2008... "Table-Valued Parameters"

CREATE TYPE in SQL Server 2005 refers to "simple" user defined data types only... notice the difference in the SQL Server 2008 CREATE TYPE

like image 30
gbn Avatar answered Jan 02 '23 05:01

gbn