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 |
|
krnlpanic
Starting Member
2 Posts |
Posted - 2010-04-08 : 12:00:00
|
| I am running this in a USP: Declare @RouteCount tinyint SELECT @RouteCount=COUNT(DISTINCT ROUTE) FROM tblCAL WHERE (tblCAL.DATESTAMP = @DateStamp or tblCAL.DATESTAMP='MASTER') AND tblCAL.LANEGROUP = @LaneGroup INSERT INTO tblCAL(STATUS, ASOF, BYUSER, DATESTAMP, LANEGROUP, ROUTE, STOP, LANE) VALUES(@RecordType, GetDate(), @User, @DateStamp, @LaneGroup, @RouteCount + 1, 1, '-')The problem that is happening is @RouteCount is NOT increasing by 1DISTINCT COUNT = 9@RouteCount + 1 = 9Any help would be greatly appreciated! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-08 : 12:09:47
|
| trying printing out value of @RouteCnt before insert and see what value it has------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
krnlpanic
Starting Member
2 Posts |
Posted - 2010-04-08 : 12:21:05
|
| Results of @RoutCount = 8So.. the USP was working correctly..Unfortunatly, I had bad data in theROUTE field which was throwing offmy SP..Thank you! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-08 : 12:24:20
|
| hmm..ok...Glad that you sorted it out------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|