Friday 20 June 2014

Add new column in existing table with default value in sql server

To perform this process just follow this,


Syntex:

Alter table <table_Name>
Add column <column_Name> null/not null default


Query:

let say user table has column username,password. now i am adding createdon(date), to achieve this

Alter table user
add column createdon null default(getdate())


Result:
along with existing data new column will added as well as value also.

happy coding :)

Thursday 12 June 2014

Difference Between Sql Server VARCHAR and NVARCHAR Data Type

Refer this following link

http://sqlhints.com/2011/12/23/difference-between-varchar-and-nvarchar/

http://social.msdn.microsoft.com/Forums/en-US/b6615caa-629b-45ac-9710-aab7f6e172b3/varchar-and-nvarchar-use-what-is-exact-difference-between-these?forum=sqldataaccess