'Microsoft SQL' Category

  • Identity

    July 14, 2006

    /* Getting the current value of identity column of a table. */SELECTIDENT_CURRENT(‘Invoice’) /* OR */ DBCC CHECKIDENT (invoice,NORESEED) /* Getting the incremental values of identity column of all tables from one database. */ USE training2005SELECT TABLE_NAME,IDENT_INCR(TABLE_NAME)AS IDENT_INCR FROM INFORMATION_SCHEMA.TABLESWHERE IDENT_INCR(TABLE_NAME)IS NOT NULL /* Getting the incremental value of identity column of a tables. */SELECT TABLE_NAME,IDENT_INCR(TABLE_NAME) [...]

  • SQL 2k Tips : UPDATETEXT

    July 4, 2006

    I have received the email from Grace on Tuesday, February 01, 2005 4:07 PM. Wow! She was sharing some interesting things related to SQL. Thank you so much, Grace! Hi Micheal, Do you know that ntext data type can’t do concatenation. To overcome this problem, we can use UPDATETEXT. The following are the example of [...]

  • EXEC & EXEC sp_executesql

    July 4, 2006

    EXEC and EXEC sp_executesql for Searching.. DECLARE @sql as nvarchar(100) DECLARE @paraDOB datetime SET @paraDOB = ’1/1/1981′ SET @sql=N” SET @sql=N’SELECT * FROM EmpMast’ SET @sql=@sql + ‘ WHERE DOB &gt;= @paraDOB’ exec sp_executesql @sql,N’@paraDOB datetime’,@paraDOB</code> Cool.. isn’t it? But there are one limitation of using sql_executesql. As this statement accept the NVARCHAR which has [...]

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org