Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-14 : 07:28:34
|
| Cliff writes "I am working on a vb.net app w/SQL Server 2K backend. App uses microsoft's Ent. library Data Access Application block for data access. The app is working fine. I have stored procedures that will not return the desired results. Below is a sample proc.SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GOSET NOCOUNT ONGoIF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'GetCaseCount') BEGIN DROP Procedure GetCaseCount ENDGOCreate Procedure GetCaseCount(@EmpID as uniqueidentifier,@CaseCount as int out)asBeginSELECT @CaseCount = Count(DISTINCT ac.casenumber)FROM dbo.[AppInventory] iInner Join dbo.[AppCase] ac On i.ProjectID = ac.ProjectID and i.caseid = ac.caseidWHERE i.ProjectID IN(SELECT ProjectID FROM fnProjectsValid()) EndGOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON goThis proc always returns 0 to the calling application. If I run the select in analyzer it works fine. If I code @CaseCount = ?? where ?? is an aribtrary number that nummber is returned to the calling application. Also if I change the select of the procedure to just do select count(*) from [table], it works and returns the correct count to the calling application. I even placed a Select @CaseCount right before the END keyword, that did not work. I also tried SET instead of select, you know, SET @CaseCount = (Select Count(DISTINCT ac.casenumber)………….., this did not work either. What is going on with this? Can anyone help?" |
|
|
|
|
|