Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Using getdate for a sproc paramater default


Message #1 by "mike kerr" <MIKEZCG@Y...> on Tue, 18 Mar 2003 20:29:40
I changed the getdate to null on line 7 then dateadd(mm,6,getdate()) to 
null also, then i had no problems.  What is the rule for sproc param 
defaults?

ALTER Proc spNewAcct
	@Balance varchar(15)= NULL, 
	@Name varchar(50)= NULL, 
	@Phone char(14)= NULL, 
	@AcctNum char(19)= NULL, 
	@NextAmt varchar(15)= NULL, 
	@NextDate smalldatetime = Getdate(), 			-- LINE 7 
ERR INCORRECT SYNTAX NEAR '('
	@Rate decimal(18,0)= NULL, 
	@RateChange smalldatetime= DateAdd(mm,6,Getdate()), 
	@website varchar(50)= NULL, 
	@WebID varchar(10)= NULL, 
	@WebPW varchar(10)= NULL,
	@CardID int = NULL OUTPUT
AS
INSERT INTO [CC].[dbo].[cc](
	[Balance], 
	[Name], 
	[Phone], 
	[AcctNum], 
	[NextAmt], 
	[NextDate], 
	[Rate], 
	[RateChange], 
	[webaddress], 
	[WebID], 
	[WebPW])
VALUES(
	@Balance, 
	@Name, 
	@Phone, 
	@AcctNum, 
	@NextAmt, 
	@NextDate, 
	@Rate, 							-- LINE 34 
MUST DECLARE @RATE
	@RateChange, 
	@Website, 
	@WebID, 
	@WebPW)


Server: Msg 170, Level 15, State 1, Procedure spNewAcct, Line 7
Line 7: Incorrect syntax near '('.
Server: Msg 137, Level 15, State 1, Procedure spNewAcct, Line 34
Must declare the variable '@R...'.

  Return to Index