日期:2014-05-18  浏览次数:20760 次

insert数据出错

CREATE TABLE a 
(id INT , NAME VARCHAR(8000))



INSERT INTO a VALUES (1,'''/*
declare @p2 int
set @p2=5713
exec GetICMaxNum 'ICSTOCKBill',@p2 output
select @p2
*/

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
''')

提示错误消息 102,级别 15,状态 1,第 5 行
'ICSTOCKBill' 附近有语法错误。


请大家给修正意见,谢谢!!


------解决方案--------------------
SQL code

CREATE TABLE a
    (
      id INT ,
      NAME VARCHAR(8000)
    )

INSERT  INTO a
VALUES  ( 1, 
'
/*
declare @p2 int
set @p2=5713
exec GetICMaxNum ''''ICSTOCKBill'''',@p2 output
select @p2
*/

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
' )

------解决方案--------------------
SQL code
--不理解你把脚本插入到数据库中做什么?
CREATE TABLE a
    (
      id INT ,
      NAME VARCHAR(8000)
    )

INSERT  INTO a
VALUES  ( 1, 
'
/*
declare @p2 int
set @p2=5713
exec GetICMaxNum ''''ICSTOCKBill'''',@p2 output
select @p2
*/

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
' )

SELECT * FROM a
/*
id          NAME
----------- -----------------------------
1           
/*
declare @p2 int
set @p2=5713
exec GetICMaxNum ''ICSTOCKBill'',@p2 output
select @p2
*/

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

(1 row(s) affected)

*/