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, June 7, 2011

Add Hindi or Phonetic Typing to your web page

hi friends generally we use google translate to type hindi or other language
in textboxes or other text editor tool.
by using this code we can directly type in engish which automatically converted to hindi or any language which we set in java script code.
    
    

change destinationLanguage to google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.TAMIL
or other language which google support.

Tuesday, April 26, 2011

Sql Function to Split a string and return a table

create ALTER FUNCTION [dbo].[Split]
(
 @RowData nvarchar(2000),
 @SplitOn nvarchar(5)
)  
RETURNS @RtnValue table 
(
 Id int identity(1,1),
 Data nvarchar(100)
) 
AS  
BEGIN 
 Declare @Cnt int
 Set @Cnt = 1

 While (Charindex(@SplitOn,@RowData)>0)
 Begin
  Insert Into @RtnValue (data)
  Select 
   Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))

  Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
  Set @Cnt = @Cnt + 1
 End
 
 Insert Into @RtnValue (data)
 Select Data = ltrim(rtrim(@RowData))

 Return
END

use it like this:
select * from dbo.Split('a,b,c,d,e,f,g',',')

Tuesday, November 2, 2010

how to select records of particular date from a sql table if time is also there?

query for select all records.
select * from tbltable

 


query for select record for particular date
select * from tblTable where dDate='10/29/2010'
but because of time there is no record retrieved in result
now if you want to record from a particular date not including time use this query
select *  from tbltable 
where DateAdd(day, datediff(day,0, dDate), 0)=DateAdd(day, datediff(day,0, '10-29-2010'), 0)

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

Tuesday, September 7, 2010

How to Set Dynamically order by Clause in sql Query ?

DECLARE @iSort int
SET @iSort = 3
SELECT * FROM tableName
order by
case when @iSort = 1 then Column1 end asc,
case when @iSort = 2 then Column2 end desc,
case when @iSort = 3 then Column3 end asc,
case when @iSort = 4 then Column4 end desc

Saturday, August 28, 2010

How to Show and Hide Div Using JavaScript?

Java Script Code

html Code
Step First 
        Step Second
    
This is Step Two Panel