Printing Variable Values to T-SQL

Printing Variable Values to T-SQL

Syntax : Print @ or

Example 1: Declare @x int ,@y int, @z int

                    Set @x=10
                    Set @y=20

                   Set @z=@x+@y
                   Print @z

Example 2:  Declare @EName varchar(50),@Salary Money
          
                    Select @EName=EName,@Salary=sal from Employee where EmpNo=1001
        
                    Print 'Salary of '+EName+' is : '+ cast(@Salary as varchar(50))

About Author: author 4 + years of Information Technology experience in understanding and analyzing the software and hardware engineering requirements, onsite and offshore management of product development. Expert work on design and development for windows,web,mobile Expert knowledge of C#,ADO.NET, ASP.Net MVC, ENTITY FRAMEWORK, LINQ,COLLECTIONS, JAVASCRIPT,AngularJs 1.0,Angular2, Jquery,Jquery-Ajax, SQL SERVER, XAML,Windows phone 8.1 Good knowledge of WCF-Restful services,WCF, WEB API-Services ,Web- Services,MIcrosoft-Azure,JUICE UI,HTML,CSS,AJAX Read More...

Join him on Google+ | Facebook | Linkedin

No comments