Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i am creating a type as table and the query is as:

SQL
create type dbo.Tbl as table(Country_Code varchar(5)
, Country_Name varchar(150)
, Country_Capital varchar(150)
, Continent_Code char(2));

but when i execute it i get a error:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.

please suggest a solution
Posted
Updated 2-Aug-15 23:25pm
v2
Comments
Suvendu Shekhar Giri 3-Aug-15 5:22am    
Everything looks fine. Just check for the schema 'dbo' is correct or not and make sure that you have selected correct database.

1 solution

You syntax indeed looks incorrect,


If you intend to create a table from an existing table then refer,

http://www.techonthenet.com/sql/tables/create_table2.php

Else, if you just want to create a table, then refer,

http://www.w3schools.com/sql/sql_create_table.asp
 
Share this answer
 
Comments
Suvendu Shekhar Giri 3-Aug-15 5:20am    
No. Read the question carefully. Syntax is fine.
vj.negi08 3-Aug-15 5:43am    
sorry guys i should have checked the version before it's 2005... :(

is there any way to do it in 2005.. ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900