Solved

having problem with a query

Posted on 2006-06-22
5
311 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now