Tuesday, September 29, 2009

join in SQL update statement ( update with match two tables)

join in SQL update statement

I had to update value from a staging table( this might be a temp table )
into another database table. Here is how I did it using a inner join in
the Update statement.



UPDATE Table1

SET Table1.Field1 = StagingTable.Field1

FROM Table1 INNER JOIN StagingTable ON Table1.Field2 = StagingTable.Field2



You can also add a where clause to this SQL:



WHERE StagingTable.Field3 IS NOT NULL

join in SQL update statement ( update with match two tables)

join in SQL update statement

I had to update value from a staging table( this might be a temp table )
into another database table. Here is how I did it using a inner join in
the Update statement.



UPDATE Table1

SET Table1.Field1 = StagingTable.Field1

FROM Table1 INNER JOIN StagingTable ON Table1.Field2 = StagingTable.Field2



You can also add a where clause to this SQL:



WHERE StagingTable.Field3 IS NOT NULL

Thursday, September 17, 2009

SQL SERVER – Add Column With Default Column

SQL SERVER – Add Column With Default Column


ALTER TABLE TestTable
ADD NewCol VARCHAR(50)
CONSTRAINT DF_TestTable_NewCol DEFAULT '' NOT NULL




ALTER TABLE Engineers
ADD book bit default '0'


Finally, you may wish to add a default constraint to an existing table. This uses the ALTER TABLE statement. The statement syntax is similar to that for adding a column specification except that in this case you specify that you wish to add a default constraint. As no column is being added, the previous default constraint syntax must be modified slightly to specify the name of the column being modified. The complete syntax is therefore:



----------------------------------------

ALTER TABLE table-name
ADD CONSTRAINT constraint-name DEFAULT default-value FOR column-name

Wednesday, September 16, 2009

RAAT YON DIL MA TARI YAAD AAI



Wednesday, September 09, 2009

Arabic Naat collection

Arabic Naat collection

Hasbi Rabbi







Naat Hasbi Rabbi 2




you came to me. Ramadan Nasheed




Mohammed Nabina




Qasida Burda Sharif in different five languages - Arabic Naat with Daff / dafli / duff