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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 stored procedure problem

Author  Topic 

reacha
Starting Member

49 Posts

Posted - 2010-10-08 : 16:20:45
SELECT @Result= (select top(1) AUDIT.Auditstamp, userid from audit where AUDIT.Audittype =5
and AUDIT.PKGID = @pkgid
order by AUDIT.Auditstamp desc)

The parameter for the procedure is pkgid and i need to capture two column values in one variable how can do this

I need to call this procedure in another procedure
and after than i need to split result to get individual values

Please help me out!!

Thanks,
reacha

X002548
Not Just a Number

15586 Posts

Posted - 2010-10-08 : 16:22:54
SELECT @Result= (select top(1) AUDIT.Auditstamp+userid from audit where AUDIT.Audittype =5
and AUDIT.PKGID = @pkgid
order by AUDIT.Auditstamp desc)

"It's a design problem" -- SWP

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx





Go to Top of Page

reacha
Starting Member

49 Posts

Posted - 2010-10-08 : 16:34:37
if i use this

SELECT @Result= (select top(1) AUDIT.Auditstamp+userid from audit where AUDIT.Audittype =5
and AUDIT.PKGID = @pkgid
order by AUDIT.Auditstamp desc)

I was getting some value like this 2011-11-14 16:13:52.273


Thanks,
reacha
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 16:35:52
And why is that a problem? What do you want it to be?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-10-09 : 13:09:11
Why do you need to 'capture' two values into a single variable? Wouldn't it be better to use two variables?

SELECT TOP 1
@auditStamp = a.Auditstamp
,@userId = a.userid
FROM Audit a
WHERE a.Audittype = 5
AND a.PKGID = @pkgid
ORDER BY a.Auditstamp desc;

Jeff
Go to Top of Page
   

- Advertisement -