Sunday, November 25, 2012

SQL Query Add new Column Existing Table

The SQL ALTER TABLE statement allows you to rename an existing table. It can also be used to add, modify, or drop a column from an existing table.

SQL ALTER TABLE - Renaming a table

To rename a table, the SQL ALTER TABLE syntax is:
ALTER TABLE table_name
  RENAME TO new_table_name;
For example:
ALTER TABLE suppliers
  RENAME TO vendors;
This will rename the suppliers table to vendors.

SQL ALTER TABLE - Adding column(s) to a table

Syntax #1
To add a column to an existing table, the SQL ALTER TABLE syntax is:
ALTER TABLE table_name
  ADD column_name column-definition;
For example:
ALTER TABLE supplier
  ADD supplier_name varchar2(50);
This will add a column called supplier_name to the supplier table.

Friday, June 15, 2012

SQL SERVER – Stored Procedure to display code (text) of Stored Procedure, Trigger, View or Object

This is another popular question I receive. How to see text/content/code of Stored Procedure. System stored procedure that prints the text of a rule, a default, or an unencrypted stored procedure, user-defined function, trigger, or view.

Syntax sp_helptext @objname = 'name'

sp_helptext [ @objname = ] 'name' [ , [ @columnname = ] computed_column_name

Displaying the definition of a trigger or stored procedure sp_helptext 'dbo.nameofsp'

Thursday, May 03, 2012

I want to make a difference.

...I want to make a difference.

...I want to leave a positive mark on this world.

...I want to make life better for those
who are less fortunate than myself.

...I want others to reap the benefits of my life's work,
even if they never know who I am.

...I want to have enough happiness to spare,
so that I can spread it around without thought.

But today...

...I just want to smile and make it through the day.

Sunday, April 01, 2012

خوش فہمی

ستارے کی گردشت ختم ہو جاتی ہے.
اور انسان ہمیشہ کے  لیے گھومتا رہتا ہے .
میں خوش  ہوں بس اب خوش فہمی نہیں ہوتی .