 |
| SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 15th, 2004, 11:45 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Stored Procedure
I keep getting incorrect syntax with this statement can anyone tell me whats wrong says incorrect syntax must declare the variable
Code:
CREATE PROCEDURE [insert_Corovan_Table_1]
@pdBegin DATETIME = TerminationDate (BETWEEN CONVERT(DATETIME, '2003-01-01 00:00:00', 102) AND CONVERT(DATETIME, '2003-12-31 00:00:00', 102))
@pdEnd DATETIME= NULL
AS
IF @pdBegin IS NULL
SET @pdBegin = DateAdd(year, -2, GetDate())
IF @pdEnd IS NULL
SET @pdEnd = DateAdd(year, 1,@pdBegin)
AS INSERT INTO [GamingCommissiondb].[dbo].[Corovan_Table]
( [TM #],
[FirstName],
[LastName],
[SS #],
[TerminationDate],
[Voluntary or Involuntary],
[Notes])
SELECT ([TM#],
[FirstName],
[LastName],
[SS #],
[TerminationDate],
[Voluntary_or_Involuntary],
[Notes],)
FROM TERMINATION
GO
|
|

September 15th, 2004, 02:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
What database is that? Is that SQL Server?
Brian
|
|

September 16th, 2004, 02:01 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
I don't quite understand the part where you declare the input parameters but normally you need to separate them by commas.
--
Joe
|
|

September 16th, 2004, 02:09 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Also I see you using 2 ASs in there, which should have exisited only once for a proc.
Code:
AS
IF @pdBegin IS NULL
...
...
AS INSERT INTO
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

September 17th, 2004, 07:04 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think that last comma
[Notes],)
shouldn't be there.
-- conrad
|
|

September 18th, 2004, 02:34 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Yes you are right conrad, I somehow left that unnoticed.
desireemm,
Now the suggestions from the previous 3 posts(joe's, mine and conrad's all that are responsible for syntax errors) would have helped you out.
_________________________
- Vijay G
Strive for Perfection
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| stored procedure |
prashant_telkar |
SQL Server 2000 |
1 |
July 9th, 2007 07:57 AM |
| Stored Procedure |
jezywrap |
SQL Server ASP |
1 |
January 3rd, 2007 12:29 AM |
| stored procedure |
kdm260 |
SQL Server 2000 |
2 |
June 19th, 2006 04:45 PM |
| Stored Procedure |
rajanikrishna |
SQL Server 2000 |
0 |
July 18th, 2005 05:01 AM |
| Help About Stored Procedure |
zhuge6 |
BOOK: ASP.NET Website Programming Problem-Design-Solution |
3 |
May 20th, 2005 09:27 AM |
|
 |