aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT, Building Your First Web Application Project
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Friday, September 23, 2011 Total Views:  

The following script demonstrates how to declare variables and initialized values in single statement in SQL Server 2008.

Method 1

DECLARE @AUTHOR VARCHAR(20) = 'AAMIR HASAN' ,

        @SITE VARCHAR(20)= 'WWW.ASPXTUTORIAL.COM'

 

I have declared two variables named @AUTHOR and @SITE and initialized with values in single statement.


Method 2

DECLARE @AUTHOR VARCHAR(20) ,

    @SITE VARCHAR(20)

SET @AUTHOR = 'AAMIR HASAN'

SET @SITE = 'WWW.ASPXTUTORIAL.COM'



Method 3:

DECLARE @DESCRIPTION TEXT(200)

SET @DESCRIPTION = 'WELCOME TO ASPXTUTORIAL.COM'

Msg 2716, Level 16, State 1, Line 2

Column, parameter, or variable #1: Cannot specify a column width on data type text.

Msg 2739, Level 16, State 1, Line 2

The text, ntext, and image data types are invalid for local variables.

 

 

Note: Method 1 is not avaible in SQL SERVER 2005 and earlier version of SQL SEVER. Data type text, ntext, or image cannot be declare and assign in single statement.

Category: All
Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5