Viewing 15 posts - 1 through 15 (of 89 total)
SELECT RIGHT(String,
CASE WHEN CHARINDEX('ssalc',REVERSE(String))= 0
THEN 0
ELSE CHARINDEX('ssalc',REVERSE(String))+5
END
)
FROM @tbl
May 19, 2014 at 2:53 am
--Load the string in table varible
DECLARE @tbl TABLE
(
String NVARCHAR(1000)
)
INSERT INTO @tbl
SELECT 'Net asset value per share' AS ID
UNION ALL SELECT 'Net Asset Value for Ignis Absolute Return Government Bond...
May 15, 2014 at 3:10 am
;with cte as
(
SELECT 'Net asset value per share' AS ID
UNION ALL SELECT 'Net Asset Value for Ignis Absolute Return Government Bond Fund . Class A GBP'
UNION ALL SELECT 'Total Outstanding...
May 15, 2014 at 2:51 am
I added the IF exist condition in the script
DECLARE @DATABASENAME sysname;
DECLARE @sql NVARCHAR(max);
SET @DATABASENAME = 'SFM_QA03'
SET @sql = N'SELECT '+'''IF NOT EXISTS (SELECT TOP 1 NULL...
May 9, 2014 at 3:19 am
DECLARE @tblNumber TABLE
(
ID INT
)
INSERT INTO @tblNumber
SELECT TOP 1000 ROW_NUMBER() OVER(ORDER BY S.Object_id) FROM sys.objects s,sys.objects si
DECLARE @tbl TABLE
(
ID INT, [Value] NVARCHAR(1000)
)
INSERT INTO @tbl
SELECT '13','Mitesh,Sohan,Oswal' UNION
SELECT '14','Pune,Kalyan,Maharashtra' UNION
SELECT '15','31,3110,311083' ...
May 2, 2014 at 4:53 am
IF OBJECT_ID('tempdb..#temp')IS NOT NULL
DROP TABLE #temp;
CREATE TABLE #temp
(
ID INT,
ID1 INT
)
INSERT INTO #temp
SELECT 1,2
UNION
SELECT 2,1
IF OBJECT_ID('tempdb..#temp2')IS NOT NULL
DROP TABLE #temp2;
CREATE TABLE #temp2
(
ID INT,
ID1 INT
)
DECLARE @tbl TABLE
(
ID INT IDENTITY(1,1),
Query NVARCHAR(1000)
)
INSERT INTO @tbl
SELECT...
April 30, 2014 at 1:29 am
Hi,
The Query execution is simmilar to below query
select *,case when headofficeid = 0 then officeid else headofficeid end [FirstSort],case when headofficeid = 0 then 1 else 2 end [SecondSort]
from offices...
April 30, 2014 at 12:24 am
SELECT [CampusID],Campus1,Campus2,[TermID],[Term],[StudentID],[Qualification],[Programme],status FROM
(
SELECT [CampusID],Campus,[TermID],[Term],[StudentID],[Qualification],[Programme],
IIF(Repeat1stYEar = '1' , 'Repeat1stYEar',
IIF([Repeat2ndYear] = '1' , 'Repeat2ndYear',
IIF(Repeat3rdYEar = '1' , 'Repeat3rdYEar',
IIF(NotReturn2ndYr = '1' , 'NotReturn2ndYr',
IIF(NotReturn3rdYr = '1' , 'NotReturn3rdYr',
IIF(NotReturn4thYr = '1' , 'NotReturn4thYr',NULL)))))) status
FROM...
April 15, 2014 at 5:58 am
;with cte
as
(
SELECT departcty ,arrivalcty ,departcty as Firstdepartcty, CAST(arrivalcty AS VARCHAR(6)) as Firstarrivalcty ,seqnum,tktamt,tktnum
FROM #xy123 where seqnum = 1
UNION ALL
SELECT s.departcty ,s.arrivalcty , Firstdepartcty as Firstdepartcty,
CASE...
April 8, 2014 at 11:43 pm
DECLARE @tbl TABLE
(
ID INT IDENTITY(1,1),
Char1 NVARCHAR(100)
)
INSERT INTO @tbl
select 'ABC x.yz'
UNION
select 'A.BC X.*YZ'
UNION
select 'A.BC *X.YZ'
DECLARE @tblNumber TABLE
(
Number INT
)
INSERT INTO @tblNumber
SELECT TOP 1000 ROW_NUMBER() OVER(ORDER BY S.Object_id )
from sys.objects s,sys.objects s1
;with...
April 7, 2014 at 10:04 pm
DECLARE @year VARCHAR(4),
@month TINYINT,
@weekday TINYINT,
@iOccAt TINYINT
DECLARE @dt DATETIME
SELECT @iOccAt = 5,@weekday =6,@month = 5,@year = 2014
select@dt= DATEADD(MM,@month-1,DATEADD(YYYY,@year-1900,0))+
CASE WHEN ...
April 7, 2014 at 5:58 am
Hi ,
The Script is going to give the create statement for all table data type which are present in the database.
So you can get the all the table datatype create...
April 4, 2014 at 6:03 am
This is because there is no record into the Source table, try to verify with the some records into the source record.
SET IDENTITY_INSERT LOAN_GROUP_INFO ON
DECLARE @NEXT_ID AS INT = (SELECT...
March 18, 2014 at 10:06 pm
IF Object_id('LOAN_GROUP_INFO') IS NULL
CREATE TABLE LOAN_GROUP_INFO
(
LGI_GROUPLVR INT ,LGI_GROUPEXPOSURE INT ,LGI_DATECREATED DATETIMEOFFSET(3),LGI_CREATEDBY INT,LGI_DATEUPDATED DATETIMEOFFSET(3) ,LGI_UPDATEDBY INT ,LGI_ISACTIVE BIT,
LGI_GROUPID INT IDENTITY (1,1)
)
GO
IF Object_id('LOAN_GROUPING') IS NULL
CREATE TABLE LOAN_GROUPING
(
LGI_GROUPLVR INT ,LGI_GROUPEXPOSURE INT ,LGI_DATECREATED DATETIMEOFFSET(3),LGI_CREATEDBY...
March 16, 2014 at 11:24 pm
In this case you can use the Union in source query so the data can be validated
MERGE INTO LOAN_GROUP_INFO AS TARGET
USING (SELECT LGI_GROUPID FROM LOAN_GROUPING
WHERE LG_LOANID = 22720
AND...
March 16, 2014 at 10:53 pm
Viewing 15 posts - 1 through 15 (of 89 total)