[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Multiple Return Parameters

Looch

3/27/2007 2:42:00 PM

Got a question with a stored procedure...

Create Procedure GetCCInfo
(
@TickNumAuto nvarchar(255),
@ExpDate datetime Output,
@CardNumber bigint output,
@CardType nchar(10) output,
@NameOnCard nvarchar (50) output,
)

as

select cc.CustomerID, cc.CardType, cc.CardNumber, cc.ExpDate,
cc.NameOnCard from dbo.CreditCards cc inner join dbo.call_log cl on
cc.CustomerID = cl.CustomerID where cl.TicketNumberAuto = @TickNumauto

from here i want to return @CardType = cc.CardType, @CardNumber =
cc.CardNumber, etc, but not sure how to go about it (msdn is down!!)

Any help in the right direction would be much appreciated!

3 Answers

jeevan

3/27/2007 3:15:00 PM

0


"Looch" <lucianoj2005@yahoo.com> wrote in message
news:1175006511.657843.102510@l77g2000hsb.googlegroups.com...
> Got a question with a stored procedure...
>
> Create Procedure GetCCInfo
> (
> @TickNumAuto nvarchar(255),
> @ExpDate datetime Output,
> @CardNumber bigint output,
> @CardType nchar(10) output,
> @NameOnCard nvarchar (50) output,
> )
>
> as
>
> select cc.CustomerID, cc.CardType, cc.CardNumber, cc.ExpDate,
> cc.NameOnCard from dbo.CreditCards cc inner join dbo.call_log cl on
> cc.CustomerID = cl.CustomerID where cl.TicketNumberAuto = @TickNumauto
>
> from here i want to return @CardType = cc.CardType, @CardNumber =
> cc.CardNumber, etc, but not sure how to go about it (msdn is down!!)
>
> Any help in the right direction would be much appreciated!

Create Procedure GetCCInfo
(
@TickNumAuto nvarchar(255),
@ExpDate datetime Output,
@CardNumber bigint output,
@CardType nchar(10) output,
@NameOnCard nvarchar (50) output,
)
as
select @CardType = cc.CardType,
@CardNumber = cc.CardNumber,
@ExpDate = cc.ExpDate,
@NameOnCard = cc.NameOnCard
from dbo.CreditCards cc
inner join dbo.call_log cl
on cc.CustomerID = cl.CustomerID
where cl.TicketNumberAuto = @TickNumauto
GO

I hope you're not planning to store unencrypted credit card info in your
database, as your query suggests.


Aaron [SQL Server MVP]

3/27/2007 3:16:00 PM

0

SELECT
@CardType = cc.CardType,
@CardNumber = cc.CardNumber,
@ExpDate = cc.ExpDate,
@NameOnCard = cc.NameOnCard
FROM
dbo.CreditCards cc
INNER JOIN dbo.call_log cl
ON
cc.CustomerID = cl.CustomerID
WHERE cl.TicketNumberAuto = @TickNumauto;


Also, you should get your terminology straight to avoid confusion... return
values and output parameters are very different animals!

--
Aaron Bertrand
SQL Server MVP
http://www.sq...
http://www.aspfa...




"Looch" <lucianoj2005@yahoo.com> wrote in message
news:1175006511.657843.102510@l77g2000hsb.googlegroups.com...
> Got a question with a stored procedure...
>
> Create Procedure GetCCInfo
> (
> @TickNumAuto nvarchar(255),
> @ExpDate datetime Output,
> @CardNumber bigint output,
> @CardType nchar(10) output,
> @NameOnCard nvarchar (50) output,
> )
>
> as
>
> select cc.CustomerID, cc.CardType, cc.CardNumber, cc.ExpDate,
> cc.NameOnCard from dbo.CreditCards cc inner join dbo.call_log cl on
> cc.CustomerID = cl.CustomerID where cl.TicketNumberAuto = @TickNumauto
>
> from here i want to return @CardType = cc.CardType, @CardNumber =
> cc.CardNumber, etc, but not sure how to go about it (msdn is down!!)
>
> Any help in the right direction would be much appreciated!
>


Looch

3/27/2007 3:49:00 PM

0

On Mar 27, 10:41 am, "Looch" <lucianoj2...@yahoo.com> wrote:
> Got a question with a stored procedure...
>
> Create Procedure GetCCInfo
> (
> @TickNumAuto nvarchar(255),
> @ExpDate datetime Output,
> @CardNumber bigint output,
> @CardType nchar(10) output,
> @NameOnCard nvarchar (50) output,
> )
>
> as
>
> select cc.CustomerID, cc.CardType, cc.CardNumber, cc.ExpDate,
> cc.NameOnCard from dbo.CreditCards cc inner join dbo.call_log cl on
> cc.CustomerID = cl.CustomerID where cl.TicketNumberAuto = @TickNumauto
>
> from here i want to return @CardType = cc.CardType, @CardNumber =
> cc.CardNumber, etc, but not sure how to go about it (msdn is down!!)
>
> Any help in the right direction would be much appreciated!

Thanks all, right - return, output parameter, still a little new to
SQL. As for the encryption, its actually only the last four numbers -
kind of a misleading name. Thanks again.