How to print the value with desired text in TSQL using sql server 2005

Select 'Customer Name is ' + cust_Name from customers where cust_Id=5;

Or

Declare @CustomerName varchar(50)
Select @CustomerName = cust_Name from customers where cust_Id=5;
Print 'Customer Name is ' + @CustomerName ;

You can declare them

Declare @CstName nvarchar(100)
Select @CstName = cust_Name from customers where cust_Id=5;
Print 'Customer Name is ' + @CstName ;

This is the bettre way while using TSQL as you asked


You can use concat()

Select concat('Customer Name is',cust_Name) as values from customers where cust_Id=5;

Click here to learn more about concat()