The SET
way to insert records is not standard SQL. If you need it to use similar sql's for updates and inserts, you should use Stored-Procedures in MS SQL-Server instead, for example:
CREATE Procedure tableInsertUpdate
(
@ID int,
@fil1 int,
@fil2 int,
@IDOut int OUTPUT
)
AS
IF EXISTS(SELECT ID from table WHERE ID=@ID)
BEGIN
UPDATE table SET
fil1 = @fil1
fil2 = @fil2
WHERE ID=@ID
SET @IDOut=null
END
ELSE
BEGIN
INSERT INTO table
(fil1, fil2)
VALUES
(@fil1, @fil2 )
SET @IDOut=scope_identity()
END
'메모' 카테고리의 다른 글
웹메일 도메인의 mx 값 설정...펌 (0) | 2014.01.11 |
---|---|
multiple insert, sql server...펌 (0) | 2014.01.10 |
천정배선 낚시대, 요비선(와이어)...펌 (0) | 2013.12.30 |
나사 빼는 법, 빠가, 머리손상...펌 (0) | 2013.12.26 |
티스토리 폐쇄후 ...펌 (0) | 2013.12.25 |