Incorrect syntax near the keyword table when I declare a table variable

北战南征 提交于 2019-12-12 13:17:36

问题


I am using Sybase database ISQL.exe. when I declare a table variable using this clause:

declare @tabVar table (fid int, name varchar(10))

I got error: could not execute statement. Incorrect syntax near the keyword 'table'

I don't see where is wrong, could any one help?


回答1:


It's not correct construction. You can't use table type variable in sybase. For this solution I suggest to use temporary table as below:

create table #tabVar 
(
 fid int, 
 name varchar(10)
)



回答2:


This must be new in Sybase; I am using it now.

DECLARE LOCAL TEMPORARY TABLE @tabVar (fid int, name varchar(10))



来源:https://stackoverflow.com/questions/13357366/incorrect-syntax-near-the-keyword-table-when-i-declare-a-table-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!