TSQL-Part1 : TSQL-Part1 Basic datatypes in Sql Server 2005 and Simple Select Statements
By
Nitin Sharma
Basic Datatypes : Basic Datatypes Strings
Fixed Length Strings
Variable Length Strings
Long Variable Length Strings
Numerics
Integers
Decimals
DateTime
Basic Datatypes : Basic Datatypes Fixed Length Strings.
Social Security Numbers.
PAN Card Numbers.
Bank Account Numbers.
Credit Card Numbers.
In Sql the datatypes which store Fixed length Strings are
CHAR (ascii characters)
NCHAR (unicode characters)
Basic Datatypes : Basic Datatypes Variable Length Strings.
Names.
Address.
Remarks.
In Sql the datatypes which store Variable length Strings are
VARCHAR (ascii characters)
NVARCHAR (unicode characters)
Basic Datatypes : Basic Datatypes Long Variable Length Strings.
Article Text.
Driving Directions.
Story.
User profile.
In Sql the datatypes which store Long Variable length Strings are
TEXT (ascii characters)
NTEXT (unicode characters)
Basic Datatypes : Basic Datatypes Long Variable Length Strings (Cont..).
TEXT can store 2GB textual data.
NTEXT can store 1GB textual data.
Basic Datatypes : Basic Datatypes Numerics.
Integers.
Decimals.
Basic Datatypes : Basic Datatypes Inetgers.
Whole Numbers without decimals.
Examples:
Number of Cars in a City.
Population.
In Sql the datatypes which store Integer type data are.
TINYINT
SMALLINT
INT
BIGINT
Basic Datatypes : Basic Datatypes Decimals.
Numbers with decimal places.
Examples:
Weight.
Height
List price.
In Sql the datatypes which store Decimal type data are.
DECIMAL
NUMERIC
FLOAT
MONEY
SMALLMONEY
Basic Datatypes : Basic Datatypes DateTime.
Date and Time data.
Examples:
Date of Birth.
Purchase Order Date.
TV Program Start Time.
In Sql the datatypes which store DateTime type data are.
DATETIME
SMALLDATETIME
SQL Queries : SQL Queries SELECT Statement
Selects Records from table(s).
SQL Queries : SQL Queries Select Statements Select information from database tables.
( Select * from customers ) selects all columns from the table customers.
SQL Queries : SQL Queries
SQL Queries : SQL Queries Select Statements Select information from database tables.
( Select companyname as Company from customers ) selects companyname column with the Alias name 'Company' from the table customers.
SQL Queries : SQL Queries
SQL Queries : SQL Queries Select Statements can be used to perform calculations
( Select 100+200 ) adds the two numbers and returns 300 as the result.