开发者

SQL Server - two statements on one line?

开发者_如何学编程How to I pass this to SQL Server, it seems to want the "Go 4" on a second line?

Insert Into tbl Values (896,0) GO 6


Are you sure you want to do this? The documentation says:

GO is not a Transact-SQL statement; it is a command recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code editor. [...] Applications based on the ODBC or OLE DB APIs receive a syntax error if they try to execute a GO command.

If you are still sure you need this, use the vbCrLf constant to insert a linebreak:

Dim sql As String = "Insert Into tbl Values (896,0)" & vbCrLf & "GO 6"


Your question is a little confusing from where I stand, but if you're trying to insert more than one record, I use something like this at work in MS SQL Server 2K all the time:

INSERT INTO table (field1, field2)
SELECT 'Value1', 'Value2'
UNION SELECT 'Value3', 'Value4'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜