Feeds:
Posts
Comments

Archive for July, 2007

SQL Server function for Count the Occurrence of Character in the string
============================================================
– Author :
– Date : 30 July, 2007
– Desc : Count the Occurrence of Character in the string
– Usage : select dbo.GetOccurrence(‘Abhishek Joshi’,’a’) 

CREATE FUNCTION [dbo].[GetOccurrence] ( @pInput VARCHAR(1000), @pSearchChar CHAR(1) )
RETURNS INT
BEGIN
DECLARE @vInputLength INT
DECLARE @vIndex INT
DECLARE @vCount INT
SET @vCount = 0
SET @vIndex = 1
SET [...]

Read Full Post »

———————————————————
TO DECLARE CURSOR AND OPEN IT TO UPDATE AND CLOSE CURSOR
———————————————————
DECLARE cur_price CURSOR
FOR SELECT PRICE,RATE,AMOUNT
FROM TBLPRICE
OPEN cur_price FETCH NEXT FROM cur_price
WHILE @@FETCH_STATUS = 0
BEGIN
 UPDATE TBLPRICE SET PRICE = (PRICE – 100) WHERE CURRENT OF cur_price
 FETCH NEXT FROM cur_price
 
END
CLOSE cur_price
DEALLOCATE cur_price
GO
- Benazir

Read Full Post »

copy this query and paste it into your query analyser
just replace column name as STATEID and run the query…
It will return all table name and column name that matches this column name
SELECT SYSCOLUMNS.NAME,SYSOBJECTS.NAME FROM SYSCOLUMNS
 
JOIN SYSOBJECTS ON SYSOBJECTS.ID = SYSCOLUMNS.ID 
WHERE SYSCOLUMNS.NAME LIKE ‘%STATEID%’ AND  SYSOBJECTS.XTYPE = ‘U’
- Benazir

Read Full Post »

Side-by-Side Execution in .Net Framework
===================================Using Side-by-Side Execution
———————————–
Side-by-side execution is the ability to install multiple versions of code so that an application can choose which version of the common language runtime or of a component it uses. Subsequent installations of other versions of the runtime, an application, or a component will not affect applications already installed.
Side-by-Side [...]

Read Full Post »

Read Word Doc using C#

We uses FileStream to read text from text file, but We have to use Microsoft’s  COM component called as “Microsoft Word 11.0 Object Library”, which provides classes and Methods to perform operation with Word Document.
From Add Reference Choose COM tab and Select “Microsoft Word 11.0 Object Library”.
We uses Word.ApplicationClass   to perform read operation with Word [...]

Read Full Post »

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Read Full Post »

ProperCase User Defined Function for SQL Server
=========================================/*************************************************************************************************
Purpose: To convert a given string to proper case
Written by: Abhishek Joshi
Tested on: SQL Server 2000
Examples:
To convert the string ‘william h gates’ to proper case:
SELECT dbo.PROPERCASE(‘william h gates’)
To convert the Notes field of titles table in pubs database to proper case:
SELECT dbo.PROPERCASE(notes) FROM pubs..titles
*************************************************************************************************/
CREATE FUNCTION PROPERCASE
(
–The string to be [...]

Read Full Post »