Saturday, January 18, 2014

Set Capital Letter On Every Word Start In Sql Server

CREATE FUNCTION InitialCap(@String VARCHAR(8000))
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @Position INT;

SELECT @String   = STUFF(LOWER(@String),1,1,UPPER(LEFT(@String,1))) COLLATE Latin1_General_Bin,
                    @Position = PATINDEX('%[^A-Za-z''][a-z]%',@String COLLATE Latin1_General_Bin);

                    WHILE @Position > 0
                    SELECT @String   = STUFF(@String,@Position,2,UPPER(SUBSTRING(@String,@Position,2))) COLLATE Latin1_General_Bin,
                    @Position = PATINDEX('%[^A-Za-z''][a-z]%',@String COLLATE Latin1_General_Bin);

                     RETURN @String;
  END ;

select dbo.InitialCap(columnname) from yourtable
UPDATE <tablename> SET <columnname> = dbo.InitialCap(<columnname>)

to remove spaces in a sql table


Update LOCATION_MST set LOCATION_NAME = ltrim(rtrim(LOCATION_NAME));

Thursday, January 16, 2014

The Web Services Enumeration Components Are Not Available Visual Studio 2008

The Web Service Enumeration Components Are Not Available. You Need To Re Install Visual Studio To Add Web References To Your Application

To Fix This Issue Run The Following Command In Visual Studio Tools--> Visual Studio 2008 Command Prompt
devenv /ResetSkipPkgs