Forum Replies Created

Viewing 15 posts - 61 through 75 (of 86 total)

  • RE: Implement 'USE' + @DB inside procedure

    Thanks Lynn,

    This question is directed to you

    Did you mean something like this ?

    @sql = ' use ' + @dbname + 'GO' + ' Insert/Update/Delete ..'

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: NULLs IN ROW_NUMBER ( ) OVER OVER' Partition By list

    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

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: NULLs IN ROW_NUMBER ( ) OVER OVER' Partition By list

    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...

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: NULLs IN ROW_NUMBER ( ) OVER OVER' Partition By list

    can u please provide me 3 records with columns included in ranking function

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: NULLs IN ROW_NUMBER ( ) OVER OVER' Partition By list

    Try Dense_Rank instead. Let me know if it work. Selecting distinct dense rank using CTE.

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: MSSQL 2008 MERGE Statement error

    Betn remove "TGT. " in the Update statement as it will automatically comsider it target

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: MSSQL 2008 MERGE Statement error

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Please post some data according to the article to check the same.

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Query For Aduit Reprt

    EXEC sp_helpdb;

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: MSSQL 2008 MERGE Statement error

    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...

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: How to dynamically execute SQL stored as text in a table

    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

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Is Clusterd Index sort and store data in physical order in table?

    I think if you check table properties it does show index usage space on the disk meaning there by a physical storage for indexes.

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Execute Multiple Queries and Maintain Error Logs

    Hi Sir,

    Can you clarify a bit about SSB ? Would it ensure an Email to my mail box for each entry in ErrorLog table ?

    _______________________________________________________________________________________________

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Execute Multiple Queries and Maintain Error Logs

    Thanks Jeff 🙂

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Parallel Processing in SQL ?

    Thanks Sir 🙂

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

  • RE: Query Help

    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...

    ______________________________________________________________________

    Ankit
    MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
    "Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
    You are already naked. There is no reason not to follow your heart.”

Viewing 15 posts - 61 through 75 (of 86 total)