Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Case sintax in a SQL Store Procedure evalauting 2 Query options

$
0
0
what will be the best way to write this code? I have the following code:BEGIN declare status_sent as nvarchar(30) SET NOCOUNT ON; case status_sent =( select * from TableSignal where ID=(SELECT id_ FROM [P_Database].[dbo].[Package] where SerialNumber=@Pallet ) and SignalId=23) when is null then 'Signal not send' when not null then 'Signal Sent' end then if Signal Sent.... do the following query:Select * from package.....if signal not sent don't do anythingany help will be appreciate it.....on how to evaluate the first query with the 2 options and based on thatoptions write the next query.

Viewing all articles
Browse latest Browse all 3145

Trending Articles