Skip to content
Advertisement

Tag: tsql

How to Run Two T-Sql Statement By Exec Command in SqlServer?

I want run 2 SQL queries in Exec instruction, how can I do this? ListOfLeaveRemainingInfo is a user-defined table type: When I run the stored procedure, I get this error: Msg 1087, Level 15, State 2, Line 33 Must declare the table variable “@LeaveRemainingTempTable” Answer Scratch the previous. @LeaveRemainingTempTable is a table variable. It therefore doesn’t exist within the scope

Sql agent job last run status

I have N jobs with M steps in each, that could change any time(Add/delete some steps). Jobs have different schedule to run. I want a query to get last run status, job id, job name of each job. Is it …

Serial number auto generation

Facing issue in auto generation of serial number. How can i use row_number() in proper manner or is there any alternative to achieve the expected results? Note: I want to write query without using CASE. Current Results: Expected Results: Answer You can try to use ROW_NUMBER window function in a subquery, then use DENSE_RANK window function to create no column

Advertisement