This is a bit of a follow on question to my previous post on a sql statement. I currently have the following statement: -
SET NOCOUNT ON;
SELECT TestRigID,SSDNumber, Description,CalibrationDue,bUserLock,DocNum,JobReference,RoutingStage,bPCBTester,bDriveTester, bObsolete, cast(SSDNumber as varchar) + ' ' + Description as SSDNumber_Description FROM Admin_SSDNumber WHERE bLogicalDelete=0 ORDER BY SSDNumber;
The area of concern is where I join the two columns together one being the SSDNumber and the other being the Description. The problem I have got is that if the SSDNumber is blank then I want to use routingstage almost as if an if statement needs to be used.
I know its not the correct syntax but an example,
If SSDNumber = then
cast(SSDNumber as varchar) + ' ' + Description as SSDNumber_Description
cast(Routingstage as varchar) + ' ' + Description as SSDNumber_Description