Search This Blog

Monday, August 31, 2009

Enable sqldependency in SQLServer 2008

aspnet_regsql.exe -S server -U user -P password -d database -ed

Thursday, August 20, 2009

how to view saved username in computer.

I was accessing other's pc and he/she has put login aunthentication for security purpose.
So instead of writing again and again username nd password I have save the password.
To view or remove it do the following steps :
1) Go to run.
2) Type rundll32.exe keymgr.dll, KRShowKeyMgr.
You will get the pc name which pc's password you have saved. To remove it click on remove.

Tuesday, August 18, 2009

import excel sheet to database

open sqlserver nd right click on db nd click import data link nd do the further process to import ur excel sheet to database.
ur data will be imported from the excel sheet to database.

Wednesday, August 12, 2009

Procedure to Delete data of database table

Create Procedure dbo.sp_EmptyAllTables (@ResetIdentity Bit)

As

Begin

Declare @SQL VarChar(500)

Declare @TableName VarChar(255)

Declare @ConstraintName VarChar(500)

Declare curAllForeignKeys SCROLL CurSor For Select Table_Name,Constraint_Name From Information_Schema.Table_Constraints Where Constraint_Type='FOREIGN KEY'

Open curAllForeignKeys

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'ALTER TABLE ' + @TableName + ' NOCHECK CONSTRAINT ' + @ConstraintName

Execute(@SQL)

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

End

Declare curAllTables Cursor For Select Table_Name From Information_Schema.Tables Where TABLE_TYPE='BASE TABLE'

Open curAllTables

Fetch Next From curAllTables INTO @TableName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'DELETE FROM ' + @TableName

If @ResetIdentity = 1 AND OBJECTPROPERTY (OBJECT_ID(@TableName),'TableHasIdentity')=1

Set @SQL = @SQL + '; DBCC CHECKIDENT(''' + @TableName + ''',RESEED,0)'

Execute(@SQL)

Fetch Next From curAllTables INTO @TableName

End

Fetch First From curAllForeignKeys INTO @TableName,@ConstraintName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'ALTER TABLE ' + @TableName + ' CHECK CONSTRAINT ' + @ConstraintName

Execute(@SQL)

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

End

Close curAllTables

Deallocate curAllTables

Close curAllForeignKeys

Deallocate curAllForeignKeys

End