Forum Replies Created

Viewing 11 posts - 16 through 26 (of 26 total)

  • RE: Help with a query

    Try this. You may need to deal with cleanup issues with the float column if the data is predictable.

     

    SELECT

     f.itemid,

     f.attributename,

     CASE WHEN (s.attributename IS NULL) OR (s.ValueColumnName <>...

  • RE: Joining tables

    The problem is indexes then. Either create or check the health of the indexes on "Calls.JOB_NUMBER", "VISITS.JOB_NUMBER", "VISITS.VISIT_NUMBER". Unless you are on a very slow box this should in 1-2...

  • RE: Joining tables

    SELECT

     c.JOB_NUMBER,

     c.LOG_DATE,

     c.ETC,

     ENGINEER = (SELECT

       ENGINEER

      FROM VISITS v

      WHERE v.JOB_NUMBER = c.JOB_NUMBER AND v.VISIT_NUMBER = (SELECT MIN(VISIT_NUMBER) FROM VISITS))

    FROM Calls c

  • RE: Joining tables

    SELECT c.*, v.ENGINEER

    FROM Calls c

     LEFT JOIN VISITS v ON v.JOB_NUMBER = c.JOB_NUMBER AND VISIT_NUMBER = 1

    The Left Join will prevent eliminating Job_number's that no one has made a visit to....

  • RE: Insert Fails

    Move the "commit transaction".

    COMMIT TRAN

    --* Misc. Stuff. Non destructive, no TRAN necessary.

    EXEC("

    PRINT 'Creating SystemSetting CipherConversion'

    INSERT INTO SystemSettings (OptionName, OptionValue) VALUES ('CipherConversion', 'Yes')

    PRINT Convert(varchar, @@RowCount) + ' Rows Inserted into...

  • RE: Select out rows into one result

    It just dawned on me where you are running into the 256 char limit. In you query analyzer select from the top bar menu "Tools" then "Options". Select the "Results"...

  • RE: Select out rows into one result

    If you need 1610 char's then:

    CREATE TABLE New (

     item INT NOT NULL,

     desx VARCHAR(1610 - 8000) NOT NULL)

    if 8000 char's is not big enough then make "desx" a text file...

  • RE: Returning multiple values to a single column

    DECLARE @text VARCHAR(2000)

    SELECT @text = @text + RTRIM(LTRIM(column_value)) + ','

    FROM Sometable

  • RE: Select out rows into one result

    This should do the trick. It uses looping but avoids using cursors

    SET NOCOUNT ON

    CREATE TABLE New (

     item INT NOT NULL,

     desx VARCHAR(100) NOT NULL)

    DECLARE @items TABLE(

     nid INT IDENTITY(1,1),

     item INT)

    INSERT INTO @items

    SELECT DISTINCT...

  • RE: UDF Craziness - Help

    Have you check the execution plan. My guess is that with Q2 it is not using an index. The same behavior can be found when the R value of an...

  • RE: Best Practice - Dynamic Query in Sproc

    I think the answer to your question is directly related to the exclusivity of indexes that are, or can be, applied to the table. A covering index that will quickly...

Viewing 11 posts - 16 through 26 (of 26 total)