June 10, 2010 at 2:40 pm
use galactic
where @customernumber = 263722
exec stp_deliverystatus
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'where'
June 10, 2010 at 2:55 pm
davidshephard (6/10/2010)
use galacticwhere @customernumber = 263722
exec stp_deliverystatus
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'where'
Use galactic is to switch database context.
In order to use the where clause, you need to also use a select, insert, delete, or update statement.
The final piece of your code is to execute a stored procedure.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
June 10, 2010 at 3:36 pm
Thanks let me try your idea..
June 11, 2010 at 5:40 am
Sounds to me like you are trying to execute a stored procedure with the "WHERE" part as your input parameter...
exec stp_deliverystatus @customernumber = 263722
Full syntax:
USE [Galactic]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[stp_deliverystatus]
@customernumber = 263722
SELECT'Return Value' = @return_value
GO
gsc_dba
June 11, 2010 at 7:33 am
Thank you sir,I have been working on this for three weeks,but I added the year parameter and get an error message:
USE [Galactic]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[stp_deliverystatus]
@customernumber = 263722
@year = 2005
SELECT 'Return Value' = @return_value
GO
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '@year'
June 11, 2010 at 7:47 am
Does the stp_deliverystatus stored proc take two parameters? If not, you can't just pass two parameters to it and expect that it'll work.
I strongly suggest at this point that you pick up an intro to SQL type book and do some background reading, or look for a basic SQL tutorial on the net.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 11, 2010 at 7:53 am
Thanks my friend,it does take two parameters I will take that advise but would like to help hear since this would be a good learning tool..
June 11, 2010 at 7:59 am
davidshephard (6/11/2010)
Thank you sir,I have been working on this for three weeks,but I added the year parameter and get an error message:USE [Galactic]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[stp_deliverystatus]
@customernumber = 263722
@year = 2005
SELECT 'Return Value' = @return_value
GO
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '@year'
I would also suggest taking the time to read Books Online, the SQL Server Help System, it would help you with the syntax of the various commands.
As your stored procedure does accept two parameters, the problem is a missing comma:
USE [Galactic]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[stp_deliverystatus]
@customernumber = 263722,
@year = 2005
SELECT 'Return Value' = @return_value
GO
June 11, 2010 at 8:01 am
USE [Galactic]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[stp_deliverystatus]
@customernumber = 263722,
@year = 2005
SELECT 'Return Value' = @return_value
GO
You need to separate the parameters with a comma. Is this the Galactic database that come with Larrson's books?
June 11, 2010 at 8:02 am
Hi Lynn and all,thanks so much only took three weeks to get it to work.
Thanks again all...
June 11, 2010 at 8:03 am
Yes from Larson's book..
June 11, 2010 at 8:10 am
davidshephard (6/11/2010)
Yes from Larson's book..
Do you mind sharing which book it is?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
June 11, 2010 at 8:12 am
SQL SERVER 2005 Reporting Services Brian Larson
ISBN139780072262391
0072262397
June 11, 2010 at 8:16 am
Thanks
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
June 11, 2010 at 8:17 am
May I suggest that you start with an introductory T-SQL book rather. T-SQL Fundamentals (Itzik Ben-Gan) is a good option. worry about things like Reporting Services when you know how to write a SQL query.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 15 posts - 1 through 15 (of 21 total)
You must be logged in to reply to this topic. Login to reply