Viewing 14 posts - 76 through 89 (of 89 total)
DECLARE @CommaSeparatorString VARCHAR(MAX),
@CommaSeparatorXMLXML
DECLARE @handle INT
SELECT
@CommaSeparatorString='1000<000 3000>,aamkmksd,ooi<></>,'
SELECT
@CommaSeparatorString=REPLACE(REPLACE(@CommaSeparatorString,'<','$^%'),'>','%^$')
SELECT
@CommaSeparatorXML=CAST('<ROOT><i>' + REPLACE(@CommaSeparatorString, ',', '</i><i>') + '</i></ROOT>' AS XML)
SELECT
@CommaSeparatorXML
SELECT
REPLACE(REPLACE(
c.value('.', 'VARCHAR(100)'),
'$^%','<'
),
'%^$','>'
)
AS ID
FROM
(
SELECT @CommaSeparatorXML AS CommaXML
)a
CROSS APPLY CommaXML.nodes('//i') x(c)
December 15, 2009 at 12:38 am
DECLARE @tblHrTABLE
(
Date_Time VARCHAR(50),
DATA VARCHAR(100)
)
INSERT INTO @tblHr
SELECT
'11/25/2009 00' , '1874'
UNION
SELECT
'11/25/2009 01' , '2360'UNION
SELECT
'11/25/2009 02' , '2783'UNION
SELECT
'11/25/2009 03' , '2778'UNION
SELECT
'11/25/2009 04' , '2689'UNION
SELECT
'11/25/2009 05' , '2681'UNION...
December 15, 2009 at 12:06 am
DECLARE @CommaSeparatorString VARCHAR(100),
@CommaSeparatorXMLXML
DECLARE @handle INT
SELECT
@CommaSeparatorString='1,2,3,4,5,6'
SELECT
@CommaSeparatorXML=CAST('<i>' + REPLACE(@CommaSeparatorString, ',', '</i><i>') + '</i>' AS XML)
SELECT
c.value('.', 'INT') AS ID
FROM
(
SELECT @CommaSeparatorXML AS CommaXML
)a
CROSS APPLY CommaXML.nodes('//i') x(c)
December 14, 2009 at 11:43 pm
DECLARE @year VARCHAR(10)
SELECT @year='2009'
SELECT
LEFT(CONVERT(VARCHAR,DATEADD(MM,number,@year),112),4)+' '+LEFT(DATENAME(MM,DATEADD(MM,number,@year)),3)
FROM
Master..spt_Values
WHERE
Type='p' AND
number < DATEPART(MM,GETDATE())-1
December 14, 2009 at 5:49 am
--===== If the test table already exists, drop it
IF OBJECT_ID('TempDB..#Table_1','U') IS NOT NULL
DROP TABLE...
December 14, 2009 at 4:40 am
DROP TABLE #TempTable
CREATE TABLE #TempTable
(
GroupName varchar(25),
FieldName varchar(25),
...
December 14, 2009 at 4:20 am
sorry for non-comments,as I avoid to write comments as my english is not that good.
In first post I just used LTRIM and RTRIM with divide string into 2 part,
simmlilarly in...
November 30, 2009 at 2:25 am
--===== Create and populate a test table
IF OBJECT_ID('TempDB..#TestTable','U') IS NOT NULL
DROP TABLE #TestTable
SELECT TOP 1000 ...
November 29, 2009 at 11:40 pm
Hi what abt this ?
--===== Create and populate a test table
IF OBJECT_ID('TempDB..#TestTable','U') IS NOT NULL
DROP TABLE...
November 29, 2009 at 11:31 pm
Hi what abt this ?
--===== Create and populate a test table
IF OBJECT_ID('TempDB..#TestTable','U') IS NOT NULL
DROP TABLE...
November 29, 2009 at 11:27 pm
IF OBject_ID('getNthOccuranceOfWeekDay') IS NOT NULL
BEGIN
DROP FUNCTION dbo.getNthOccuranceOfWeekDay
END
GO
CREATE FUNCTION dbo.getNthOccuranceOfWeekDay
(
@year VARCHAR(4),
@month TINYINT,
@weekday TINYINT,
@iOccAt TINYINT
)
RETURNS DATETIME
AS
BEGIN
DECLARE @dt DATETIME, @dtNextMonth DATETIME,@retDate DATETIME,@WkTINYINT
SELECT
@dt= DATEADD(mm,@month-1,@year),--CAST(@year AS CHAR(4))+'-'+CAST(@month AS CHAR(2))+'-01'
...
November 27, 2009 at 3:36 am
please check this ,
DECLARE @srtWord VARCHAR(8000)
SELECT
@srtWord = '1'+SPACE(7998)+'2'
select @srtWord
select @srtWord = REPLACE(REPLACE(REPLACE(CAST(@srtWord AS VARCHAR(MAX)),' ','$#$'),'$$#',''),'$#$',' ')
select @srtWord
November 26, 2009 at 10:01 pm
November 24, 2009 at 4:58 am
November 24, 2009 at 4:55 am
Viewing 14 posts - 76 through 89 (of 89 total)