I am trying to create stored procedure i Query analyzer in visual studio 2005. I am having
difficulty though. Whenever I press the execute button, here is the error message I get:
Msg 102, Level 15, State 1, Procedure MarketCreate, Line 21
Incorrect syntax near 'MarketName'.
Here is the stored procedure. Note that the very first column in named "MarketId" but I did not
include it in the stored procedure since it should be auto generated.
USE [StockWatch]
GO
/****** Object: StoredProcedure [dbo].[MarketCreate] Script Date: 08/28/2007 15:49:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[MarketCreate]
(
@.MarketCode nvarchar(20),
@.MarketName nvarchar(100),
@.LastUpdateDate nvarchar(2),
@.MarketDescription nvarchar(100)
)
AS
INSERT INTO Market
(
MarketCode
MarketName
LastUpdateDate
MarketDescription
)
VALUES
(
@.MarketCode
@.MarketName
@.LastUpdateUser
@.MarketDescription
)
You need to use comma's to separate the column names.
USE[StockWatch]GO
/****** Object: StoredProcedure [dbo].[MarketCreate] Script Date: 08/28/2007 15:49:26 ******/
SET ANSI_NULLSONGO
SET QUOTED_IDENTIFIERONGO
CREATEPROCEDURE [dbo].[MarketCreate]
(
@.MarketCodenvarchar(20),@.MarketNamenvarchar(100),
@.LastUpdateDatenvarchar(2),@.MarketDescriptionnvarchar(100)
)
AS
INSERTINTO Market(
MarketCode,
MarketName,
LastUpdateDate,
MarketDescription
)
VALUES
(
@.MarketCode,@.MarketName,
@.LastUpdateUser,@.MarketDescription
)
|||Thanks !
No comments:
Post a Comment