Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure not returning data 1

Status
Not open for further replies.

DaveMac1960

IS-IT--Management
Mar 16, 2007
16
US
Everyone,
I have a stored procedure that I call from .net that should be returing data rows. If I plug in the values manually, the stored procedure returns the correct data rows. When I run it from debug I can see the parameters I am passing are there, yet it doesn't return any data rows. Can someone please tell me the idiocy I must be doing.

Here's the stored procedure:
ALTER PROCEDURE dbo.Weekly_selSchedule_Stv
@prmdtmSelectedDate DateTime,
@prmCalendar varchar

AS
SELECT pd.DrInit,
ps.physicianID,
ps.headerID,
ps.schedDate,
ps.hospitalID,
ps.serviceID,
ps.calendarID,
ps.comments,
psvc.service

FROM PhyWeeklySchedule ps

INNER JOIN PhyDoctor pd ON ps.physicianID = pd.DrID
LEFT JOIN PhyCalType pct ON pct.caldate = ps.schedDate
LEFT JOIN phyWeeklyServices psvc ON ps.serviceID = psvc.headerID

WHERE ps.schedDate = @prmdtmSelectedDate AND ps.HospitalID = 'Stv @ Naab Road'
AND ps.calendarID = @prmCalendar

ORDER BY schedDate, DrInit

As I said, when I plug in the values manually it returns just what it is supposed to, yet calling it from .net returns nothing even though the parameters values are being populated. I would greatly appreciate any help.

Thanks in advance,
Dave

 
The problem here is that you are using a varchar parameter without specifying the size.

Code:
ALTER PROCEDURE dbo.Weekly_selSchedule_Stv
    @prmdtmSelectedDate DateTime,
    @prmCalendar varchar[!](20)[/!]

AS
etc.......

Without specifying the size, you were getting a varchar(1), which probably doesn't match any data, so you got 0 rows returned.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Unbelievable! LOL! I knew it had to be something stupid. I guess I stared at it too long and just missed it. I beat my head on the desk for probably 2 hours starring at it yesterday. :)

Thanks for your help,
Dave
 
Don't cha hate when that happens? I'm glad you got your problem resolved, and I'm glad I was able to help.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top