Viewing 15 posts - 16 through 30 (of 40 total)
dwain.c (10/16/2013)
As long as you don't have any duplicates in the MAX date:
SELECT * FROM #AllData WHERE CONVERT(VARCHAR(20),DateStarted) + CONVERT(VARCHAR(30), ProductID) IN(
SELECT CONVERT(VARCHAR(20),max(DateStarted))+ CONVERT(VARCHAR(30), ProductID) FROM #AllData
group BY ProductID)
October 16, 2013 at 11:10 pm
Please provide the Sample data and the result how you expect?
October 9, 2013 at 3:52 am
Hi,
You can try with help of replace and convert functions
REPLACE(CONVERT(CHAR(16),DATEADD( MINUTE, DATEDIFF( MINUTE, 0, DATEADD( YEAR, -2, GETDATE())), 0), 126), 'T', ' ')
October 8, 2013 at 12:54 am
Hi,
Try with this code
delete from tableA where ConsumerID in(
select ConsumerID from tableB where ConsumerID not in(
select ConsumerID from tableB
where DeleteFlag = 0))
October 7, 2013 at 11:43 pm
SrcName (10/3/2013)
(
spid smallint ,
ecid smallint , ...
October 3, 2013 at 11:57 pm
Hi,
This query will give two rows one is with running (blocking)
and other one is suspended (blocked)
SELECT r.session_id,
s.host_name,
s.login_name,
s.original_login_name,
r.status,
r.command,
r.cpu_time,
r.total_elapsed_time,
t.text as Query_Text
FROM sys.dm_exec_requests r
...
October 3, 2013 at 7:01 am
This script provide query and SPID of blocking and SPID and blocked SPID.
and gives the blocking object name
SELECT
tl.request_session_id,
wt.blocking_session_id,
OBJECT_NAME(p.OBJECT_ID) BlockedObjectName,
tl.resource_type,
h1.TEXT AS RequestingText,
h2.TEXT AS BlockingTest
FROM sys.dm_tran_locks AS tl
INNER JOIN sys.databases db ON...
October 3, 2013 at 6:53 am
By mistaken two times posted the same.
October 3, 2013 at 6:34 am
This can be achieved using CTE
declare @person table (PersonID int, ApptDate datetime, ApptStatus varchar(10), NoOfAppts int, OneStopOrNot VARCHAR(10))
insert into @person (PersonID, ApptDate, ApptStatus, NoOfAppts) values
(49820,'07-09-2013','Seen',1),
(49827,'12-sep-2013','Seen',1),
(49831,'07-sep-2013','Seen',1),
(49834,'07-sep-2013','Seen',1),
(50084,'07-sep-2013','Seen',1),
(50097,'05-sep-2013','Seen',1),
(50172,'05-sep-2013','Seen',1),
(50172,'27-sep-2013','Seen',2),
(50175,'05-sep-2013','Seen',1)
;WITH persons AS (
SELECT
...
October 3, 2013 at 5:41 am
Hi,
This can be achieved using CTE
declare @person table (PersonID int, ApptDate datetime, ApptStatus varchar(10), NoOfAppts int, OneStopOrNot VARCHAR(10))
insert into @person (PersonID, ApptDate, ApptStatus, NoOfAppts) values
(49820,'07-09-2013','Seen',1),
(49827,'12-sep-2013','Seen',1),
(49831,'07-sep-2013','Seen',1),
(49834,'07-sep-2013','Seen',1),
(50084,'07-sep-2013','Seen',1),
(50097,'05-sep-2013','Seen',1),
(50172,'05-sep-2013','Seen',1),
(50172,'27-sep-2013','Seen',2),
(50175,'05-sep-2013','Seen',1)
;WITH persons AS...
October 3, 2013 at 5:38 am
parulprabu (9/30/2013)
Hi,Try with this code
where id=@id and month=@month and Eid=
case when @Eid=0 then case when Eid>0 then Eid else 0 end else @Eid end =Eid
Sorry for the erroneous solution given....
September 30, 2013 at 10:31 pm
Sean Pearce (9/30/2013)
kapil_kk (9/30/2013)
SrcName (9/30/2013)
can you put your code in more details?What are these T.labeltext , T.LabelKey, T.FileID.
error message is clear
SELECT 'UPDATE table_1 T
SET labeltext ='+ T.labeltext
'WHERE LanguageID...
September 30, 2013 at 4:26 am
Hi,
Try with this code
where id=@id and month=@month and Eid=
case when @Eid=0 then case when Eid>0 then Eid else 0 end else @Eid end =Eid
September 30, 2013 at 2:02 am
Hi,
Use this script
DECLARE @test-2 VARCHAR(500)
SET @test-2 = 'my email is Test@email.com.au how do i capture just the email'
SELECT REVERSE(SUBSTRING(REVERSE(@test),CHARINDEX('@',REVERSE(@test))+1,CHARINDEX(' ',REVERSE(@test),CHARINDEX('@',REVERSE(@test)))-CHARINDEX('@',REVERSE(@test))))
+SUBSTRING(@test,CHARINDEX('@',@test),CHARINDEX(' ',@test,CHARINDEX('@',@test))-CHARINDEX('@',@test))
September 30, 2013 at 1:53 am
Viewing 15 posts - 16 through 30 (of 40 total)