Skip to content
Advertisement

Tag: stored-procedures

Selecting specified query from multiple select statement inside a single stored procedure

Good Day everyone! I’ve been searching everywhere on how to get a specified query using if-else statement inside a single stored procedure but still no luck on how to achieve those function. Here’s the T-Sql When exec command is called, it only return Command(s) completed successfully instead the value/table of the selected command. Since the @action is null, it should

SQL Join based on a column value

I want to Join different tables based on column value if [dbo].[fin_FixedAssetRegister].TransactionType = ‘IOD’ then join [dbo].[sms_IssueOrderDetail] if [dbo].[fin_FixedAssetRegister].TransactionType = ‘GRND’ then join [dbo].[sms_GoodsReceivedNoteDetail] if [dbo].[fin_FixedAssetRegister].TransactionType = ‘OBL’ then join [dbo].[sms_OpeningBalanceSMSDetail] Answer You would typically use several left joins. Your question gives very little information about the underlying structures, but the idea is: THe <???> represent the names of the

Procedure with cursor has missing output

I am working on an SQL Server procedure that I would like to have print the department name and students name Similar to the attached snippet The formatting should look like the attached sample snippet and there are two columns involved. students and department tables. The problem is that the results are incomplete/seems to be getting cut off below is

Using arithmetic operators and/or brackets in a LIMIT clause

I have the following small subquery in query in stored procedure. But there is the syntax error: “(” is not valid at this position, expecting an identifier So, the question is: do I have a possibility to use brackets and/or arithmetic operators in LIMIT clause? Documentation says I can use local variables in LIMIT clause within stored procedure. Do I

Advertisement