在SQL Server中创建类型表 [英] creating type table in sql server

查看:139
本文介绍了在SQL Server中创建类型表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在创建一个类型为表,查询为:

Hi,

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

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


但是当我执行它时,我得到一个错误:

消息156,第15级,状态1,第1行
关键字"as"附近的语法不正确.

请提出一个解决方案


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

推荐答案

您的语法确实看起来不正确,


如果要从现有表创建表,请参考,

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

否则,如果您只想创建一个表,请参考,

http://www.w3schools.com/sql/sql_create_table.asp
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


这篇关于在SQL Server中创建类型表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆