Forum Replies Created

Viewing 15 posts - 1,156 through 1,170 (of 6,036 total)

  • RE: View for real-time list pulls in an OLTP

    vilyana (9/19/2016)


    Sergiy (9/19/2016)


    It seems the design is faulty.

    PatientMedicationCourse must be allocated to PatientTherapyCourse, not directly to PatientTreatment.

    Medications prescribed for one Therapy Course must not be mixed with medications for another...

  • RE: View for real-time list pulls in an OLTP

    It seems the design is faulty.

    PatientMedicationCourse must be allocated to PatientTherapyCourse, not directly to PatientTreatment.

    Medications prescribed for one Therapy Course must not be mixed with medications for another one.

    Relying on...

  • RE: create single quotes around @variable

    Tom Goltl (11/19/2007)


    You can also use char(39) as a single quote.

    Example.

    Select char(39) + name + char(39) from sysobjects

    Just build your string using char(39) to surround your strings. I find...

  • RE: Temporary tables

    SQLBill (9/14/2016)


    While probable not quite accurate...the way to think about is this way...when using a single # think of it as being owned by the schema that made it:

    Conn1.temp01

    Conn2.temp01

    When using...

  • RE: delete millions of rows

    It all comes back to following the clustered index.

    😛

  • RE: two cursors in one sp getting infinite loop

    If you're not feeling like emotionally attached to cursors then this should work fro you:

    declare @PATIENT_ID int = 191

    SELECT PATIENT_ID,VITAL_SIGN_ID,TS.CM_VITAL_TASK_SCHEDULE_ID, DATEADD(dd, t.N, SCHEDULE_START_DATE) EventDate, FREQUENCY_TIME EventTime

    FROM TASK_SCHEDULES TS

    INNER JOIN dbo.Tally...

  • RE: two cursors in one sp getting infinite loop

    WHILE in that loop will never stop.

    Value of @TSF_CM_VITAL_TASK_SCHEDULE_ID is coming from TSF.CM_VITAL_TASK_SCHEDULE_ID which according to the cursor query is equal to @CM_VITAL_TASK_SCHEDULE_ID:

    SELECT TSF.CM_VITAL_TASK_SCHEDULE_ID,FREQUENCY_TIME

    FROM TASK_SCHEDULE_FREQ TSF

    JOIN SCHEDULE_FREQUENCY SF ON SF.SCHEDULE_FREQUENCY_ID...

  • RE: two cursors in one sp getting infinite loop

    Did you forget FETCH NEXT in the inner cursor?

    OPEN db_getTaskSchFreq

    FETCH NEXT FROM db_getTaskSchFreq INTO @TSF_CM_VITAL_TASK_SCHEDULE_ID, @FREQUENCY_TIME

    WHILE @CM_VITAL_TASK_SCHEDULE_ID = @TSF_CM_VITAL_TASK_SCHEDULE_ID

    BEGIN

    PRINT @SCHSTARTDATE+1

    --SELECT @SCHTIME,@SCHSTARTDATE,@SCHENDDATE,@SCHFREQTP,@VITAL_SIGN_ID,@CM_VITAL_TASK_SCHEDULE_ID

    -- INSERT INTO TASK_EVENTS(PATIENT_ID,VITAL_SIGN_ID,CM_VITAL_TASK_SCHEDULE_ID,EVENT_DATE,EVENT_TIME,

    --EVENT_SLOT,ASSIGNED_TO,CM_TASK_EVENT_STATUS_ID,PAT_VITAL_SIGN_ID,IS_CONFIRMED,FACILITY_ID,CUSTOMER_ID,GN_STATUS,

    --GN_MACHINE_IP,CREATED_BY,CREATED_ON,EDITED_BY,EDITED_ON,EVENT_END_DATE,EVENT_TYPE_CODE)

    -- VALUES(@PATIENT_ID,@VITAL_SIGN_ID,@CM_VITAL_TASK_SCHEDULE_ID,@SCHSTARTDATE,@FREQUENCY_TIME,1,1,1,NULL,'Y',3,2,1,'127.0.0.1',

    -- 1,GETDATE(),1,GETDATE(),@SCHSTARTDATE,1)

    FETCH NEXT FROM...

  • RE: Getting DB Name from query cache

    Actually in the topic you referenced Boris from MSFT provided a query which returns dbid's for cached plans.

    But you have to remember - some dbid's returned by it are odd.

    And...

  • RE: Getting DB Name from query cache

    dbid makes sense only for DDL queries - CREATE PROC, ALTER VIEW, etc.

    For "adhoc" DML queries you're asking for there is no certain database they can be mapped to.

    A single...

  • RE: format query result

    abhas (9/14/2016)


    i have to write q query which would display result as below:

    Department Name Salary ...

  • RE: Query takes 1.5 minutes from SQL but more than 1 hour from application

    You have 3 OR's in line with all the AND's.

    Looks like the logic of the WHERE clause is broken.

  • RE: Query takes 1.5 minutes from SQL but more than 1 hour from application

    in WHERE clause change all checks like this:

    [worksheetname] IS NOT NULL

    AND Datalength([worksheetname]) > 0

    to this:

    [worksheetname]>''

  • RE: Insert Procedure running very slow - Please advice !!!

    This should go faster:

    insert into TypeRollup (col1,col2........as selected below...)

    SELECT cpt.col1, cpt.col2,... ...... cpt.col10

    FROM PType cpt

    WHERE CLM_PKey = @PartKey

    and PTypeID BETWEEN 1 AND 11

  • RE: is there a way to select column data for columns with an ordinal position < a particular ordinal position?

    They even created the "getordinal" function for you:

    SELECT COLUMNPROPERTY(OBJECT_ID(@TableName), @ColumnName,'ColumnId')

Viewing 15 posts - 1,156 through 1,170 (of 6,036 total)