sql查询给出错误plz给出一个解决方案 [英] Sql query give an error plz give an solution

查看:130
本文介绍了sql查询给出错误plz给出一个解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下查询给出的错误更接近as.this查询用于创建与另一个相同的结构



the following query give an error nearer to as.this query use for creating the same structure as another

Create table emp1 as select * from emp where 1=2;










Error:Msg 156, Level 15, State 1, Line 1<br />
Incorrect syntax near the keyword ''as''.

推荐答案

尝试以下



Try the below

Select * Into emp1 
from emp where 1=2;







参考以下链接它会对你有所帮助



http://www.w3schools.com/sql/sql_select_into.asp [ ^ ]


SELECT column_name(s)
    INTO dbo.emp1
FROM dbo.emp WITH(NOLOCK) 
WHERE 1=1





尝试这个我想这就是你要找的。



try this I guess this is what you looking for.


CREATE TABLE TABLE2
AS
SELECT * FROM TABLE1 WHERE 1=2



这是在 Oracle 中复制表结构的快捷方式!为什么你在SQL中使用它我无法理解!..要在SQL中使用它,你需要使用上述2个解决方案。


This is a shortcut for copying a table structure in Oracle! Why you use it in SQL i can''t understand!..To use this in SQL you need to use as above 2 solutions stated.


这篇关于sql查询给出错误plz给出一个解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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