Skip to content
Advertisement

Tag: sql-server-2012

How to select data where more than one column is populated

I have a sample table, called [SAMPLES] which I’ve added multiple columns to the end for different types of lab analysis results, however for the majority of samples only one analysis has been completed. I want to be able select only the samples where more than one analysis has been completed on the same sample. The table structure is something

Concatenate from rows in SQL server

I want to concatenate from multiple rows Table: |id |Attribute |Value | |——–|————|———| |101 |Manager |Rudolf | |101 |Account |456 | |101 |Code |B | |102 |Manager |Anna | |102 |Cardno |123 | |102 |Code |B | |102 |Code |C | The result I’m looking for is: |id |Manager|Account|Cardno|Code | |——–|——-|——-|——|———-| |101 |Rudolf |456 | |B | |102 |Anna |

IF when zero result from another Stored Procedure

I have a Stored Procedure which contains an Insert statement on it. From the above Stored Procedure, I want to have a condition from result of another Stored Procedure. With the following action: So, if cBranch is zero. Then execute Sp1 else do nothing. Need advice please. Really appreciated. Answer Try This:

Advertisement