Forum Replies Created

Viewing 15 posts - 1,381 through 1,395 (of 1,494 total)

  • RE: count distinct record with join

    Your column names seem to be confused, but this may be what you want:

    -- *********************

    -- Test Data

    DECLARE @tblCurrentWinTrainingLog TABLE

    (

     EmpNo CHAR(6) COLLATE DATABASE_DEFAULT NOT NULL

     ,tdate SMALLDATETIME NOT NULL

     ,trainingname VARCHAR(30) COLLATE DATABASE_DEFAULT...

  • RE: Select query and ISNULL

    Probably best done on the front end, but the following should work:

    SELECT userid

     ,[name]

     ,address

     ,CASE

     WHEN columnA IS NULL AND columnB is NULL

     THEN 'None'

     WHEN columnA IS NULL

     THEN columnB

     WHEN columnB IS NULL

     THEN columnA

     ELSE columnA...

  • RE: Multple If Statements with slow performance

    That sounds like caching. Run them both a couple of times and then compare performance.

  • RE: Multple If Statements with slow performance

    How long did the select statement take and how long did the SP take?

  • RE: Multple If Statements with slow performance

    OK. Does running the following SP run like

    EXEC dbo.Test @pShipmentStatus = 'Live'

    still take 22 secs?

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    CREATE PROCEDURE dbo.Test

     @pOrderStatus VARCHAR(10) = ''

     ,@pShipmentStatus VARCHAR(10) = ''

    AS

    SET NOCOUNT...

  • RE: Multple If Statements with slow performance

    In QA, if

    select * from v_ORder where ShipmentStatus = 'Live'

    takes 2 secs to run, how long does:

    DECLARE @test-2 varchar(10)

    SET @test-2 = 'Live'

    SELECT *

    FROM v_ORder

    WHERE ShipmentStatus = @test-2

    take to run?

     

  • RE: Day of the week

    SELECT DATENAME(dw, GETDATE())

  • RE: Urgent UPDATE statement

    You will get a quicker response in the T-Sql forum.

    This should work but probably can be optimized.

    I do not have time to look at it further.

    -- Test Data

    DECLARE @Rate TABLE

    (

     DialCode...

  • RE: Date format Question

    Sreejith is pointing out that DATETIME is just a number and how you see it formatted depends on a number of settings.

    To explicitly format the DATETIME in US format, you...

  • RE: Dynamic Search stored procedure

    You keep posting this code, which does not make much sense. Try starting with something like:

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    CREATE PROCEDURE dbo.TestProc

     @quiz NVARCHAR(25)

    AS

    SET NOCOUNT ON

    CREATE TABLE #tmpTrained

     (EmplID CHAR(30)...

  • RE: UDF inconsistent returns

    Following David’s suggestion, which will require your TEXT column to always be <= 8000 characters and to be converted to VARCHAR, try this:

    -- Test Data

    DECLARE @t TABLE

    (

     TID INT not null

     ,TText...

  • RE: Multple If Statements with slow performance

    Sergiy was asking for the datatypes, and lengths, of the ShipmentStatus and OrderStatus columns in the table/tables that lie beneath the view.

  • RE: UDF inconsistent returns

    I missed one of your dates in my previous post. Now corrected:

    -- Test Data

    DECLARE @t TABLE

    (

     TID INT not null

     ,TText TEXT null

    )

    INSERT @t

    SELECT 1, 'Rental No. 00088 Items: GIZMO (CW105715) Rental...

  • RE: UDF inconsistent returns

    If the date you are looking for always terminates with 'PATIENT NAME:', why bother with a function? eg:

    -- Test Data

    DECLARE @t TABLE

    (

     TID INT not null

     ,TText TEXT null

    )

    INSERT @t

    SELECT 1, 'Rental...

  • RE: Compatibility level 80 Outer Join operator gives different results than Compatibility level 90 OUTER JOIN

    With the =* and *= notation, I find it best to think of the * being against the table where every row is displayed.

    eg. Assuming AID does not allow nulls:

    SELECT col1...

Viewing 15 posts - 1,381 through 1,395 (of 1,494 total)