Viewing 15 posts - 61 through 75 (of 85 total)
Thanks Lynn,
This question is directed to you
Did you mean something like this ?
@sql = ' use ' + @dbname + 'GO' + ' Insert/Update/Delete ..'
October 12, 2011 at 10:01 am
WITH CTE
AS
(SELECT [SITE]
,[Hospital]
,[LOCATION]
,[Real_Date_Time]
,[NURSE_ID]
,[PRIMARY_NAME]
,[ERROR_CODE]
,[PMP]
,[PAT_NUM]
,[UniqueID]
,[PTNAME]
,[SCANNED_DATA]
,[DRUG_DESC_SCAN_ERR]
,[Sig]
,[Sig_Desc]
,[Frequency]
,[SCH_PRN]
,ROW_NUMBER() over (partition by
datepart(hour,real_date_time)
,nurse_ID
,pat_num
,pmp <== may be null
,ERROR_CODE
order by
datepart(hour,real_date_time)
,nurse_ID
,Pat_num
,pmp
,ERROR_CODE) rNum
FROM LoadTblAllDatanoDuplicates, etc
)
DELETE FROM CTE WHERE ROWNUM > 1
AND PMP IS NOT NULL
October 11, 2011 at 10:21 pm
What I understand is you want to make use of other columns irrespective of null in participating column. Please let me know if my understanding is correct.
Either use
[code="row_number...
October 11, 2011 at 1:48 pm
can u please provide me 3 records with columns included in ranking function
October 11, 2011 at 12:32 pm
Try Dense_Rank instead. Let me know if it work. Selecting distinct dense rank using CTE.
October 11, 2011 at 12:17 pm
Betn remove "TGT. " in the Update statement as it will automatically comsider it target
October 11, 2011 at 11:35 am
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Please post some data according to the article to check the same.
October 11, 2011 at 11:31 am
The MERGE SQL statement requires a semicolon (;) as a statement terminator. Otherwise Error 10713 is raised when a MERGE statement is executed without the statement terminator.
Its just the way...
October 11, 2011 at 10:50 am
Hi martin in case you have time can you let me know why you were passing a int (variable) and equating it to varchar inside it
October 10, 2011 at 11:27 am
I think if you check table properties it does show index usage space on the disk meaning there by a physical storage for indexes.
October 10, 2011 at 11:17 am
Hi Sir,
Can you clarify a bit about SSB ? Would it ensure an Email to my mail box for each entry in ErrorLog table ?
_______________________________________________________________________________________________
October 9, 2011 at 2:20 pm
WITH CTE AS
(SELECT A1,A2, ROW_NUMBER() OVER (PARTITION BY A1 ORDER BY A1) AS ROWNUM
FROM TEST
WHERE A2 = 1 OR A2 = 4
)
SELECT A1
FROM CTE
WHERE ROWNUM = 2
This...
October 3, 2011 at 1:58 am
Viewing 15 posts - 61 through 75 (of 85 total)