Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Friday, December 23, 2011

How to Enable Database and table For SQLCacheDependency

Start Visual Studio Command Prompt and enter these commands for enable sqlcachedependency in your application
for enabling a database
for enabling a database
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -ed

for diUserNamebling a database
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -dd

for enabling a table
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -t Table -et

for diUserNamebling a table
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -t Table-dt

for listing tables
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -lt

Sunday, June 12, 2011

How to Enable Service Broker on SQL Server 2005 ?

You can check to see whether the Service Broker is enabled on your server by executing the following SQL syntax:
SELECT name, is_broker_enabled FROM sys.databases where name='YourDBName'
To enable the Service Broker on your database, you must execute the ALTER DATABASE command. The following SQL command will enable the Service Broker service on the your database:
ALTER DATABASE YourDBName SET ENABLE_BROKER

Tuesday, October 12, 2010

case statement in sql query.

SELECT col1,col2,col3,
case col4 when 0 
 then 'Approve'
 else 'Un-Approve'
 end as Approved as 'Colum4',
col5      
  FROM tblTest

Monday, August 23, 2010

Auto Generated Serial Number in a SQL Query

select ROW_NUMBER() over (order by ID) as RowNumber from tableName

How to Convert Date in dd-MM-yyyy format in Sql ?

select convert(varchar(50),getdate(),105)