Solved

having problem with a query

Posted on 2006-06-22
5
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

617 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