Solved

having problem with a query

Posted on 2006-06-22
5
313 Views
Last Modified: 2008-03-17
I am trying to run this stored procedre in MS sql server db

CREATE PROCEDURE ccim_getSponorSize( @chapter_id varchar(20)) AS

select count(*) as logid
from  ccim_ChapterSponsors
where ccim_ChapterSponsors.Customer = @chapter_id
and  ccim_ChapterSponsors.display_add ='1'
GO

the display_add field is an int field

it doesn't give any syntax error but when i press apply it gves this error

Error 21037

 Any help will be greatly appreciated

0
Comment
Question by:huzefaq
5 Comments
 
LVL 6

Expert Comment

by:davbouchard
ID: 16962304
Can't have quotes for a int field.

and  ccim_ChapterSponsors.display_add = 1
0
 

Author Comment

by:huzefaq
ID: 16962776
it ried that also but still no luck

Also t runs fine on sql analyzer
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 16963148
show us the ddl for ccim_ChapterSponsors
and how you are executing the stored procedure...
also confirm which version / editon of sql server you are using..
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 16964154
Try this:
CREATE PROCEDURE ccim_getSponorSize
@chapter_id varchar(20)
AS
select count(*) as logid
from  ccim_ChapterSponsors
where ccim_ChapterSponsors.Customer = @chapter_id
and  ccim_ChapterSponsors.display_add = 1
GO

'1' vs 1 is fine, but it's always better to match the type when you can :)
0
 
LVL 3

Accepted Solution

by:
chhapia_chintak earned 500 total points
ID: 16967429
Because of followinig two reasons the error can occur

-This error occurs when editing a stored procedure in Enterprise Manager and the name of the stored procedure is different from the name specified in the CREATE PROCEDURE specified in your script.  Make sure that the stored procedure you specified, in this case procSummaryRev, is the same as the name of the original stored procedure when you are editing it.

- The error may have happened when you renamed the stored procedure in Enterprise Manager then you are trying to edit it and the name of the stored procedure in the script does not match the new name of the stored procedure.  You simply have to make sure their names are the same.

Hope this helps.



0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question