Forum Replies Created

Viewing 15 posts - 166 through 180 (of 321 total)

  • RE: Left outer Query optimization

    Can you post your execution plan for your query

  • RE: joining on a table twice

    If you want to keep your design

    you can write a function retrieveStatusName(StatusCode) wich returns StatusName

    and use it in the select LIST.

    Your performance will be affected by using a select...

  • RE: Error Creating SP

    one work arround can be

    select case when task_attribs.string_value='XX'+replicate(' ',len(task_attribs.string_value)) then ''

    else task_attribs.string_value end

    group by task_attribs.string_value

  • RE: Error Creating SP

    Seems that the problem is caused by the CASE

    statement.

  • RE: Error Creating SP

    yes

    rtirm(task_attribs.string_value)!=task_attribs.string_value

    you can replace task_attribs.string_value with

    rtrim(task_attribs.string_value) in your select and will work

     

  • RE: Error Creating SP

    Because you are grouping by

     GROUP BY ...

       RTRIM(task_attribs.string_value),

     

    not task_attribs.string_value that you use in your select clause

  • RE: BULK INSERT with fixed length text file

    Format file for Bulk insert use option [ [ , ] FORMATFILE = 'format_file_path' ]

    [ [ , ] FORMATFILE = 'format_file_path' ]

    Test62.fmt:

    -------------start----------------------

    8.0

    11

    1       SQLCHAR       0       15      ""                        1     name          ...

  • RE: Stored Procedure.

    declare @t table(ID int identity(1,1),Num1 int,Num2 int ,Num3 int,Num4 int, Num5 int)

    declare @n1 int,@n2 int,@n3 int,@n4 int,@n5 int ,@mis int

    select

    @n1=21,

    @n2=33,

    @n3=34,

    @n4=45,

    @n5=46,

    @mis=35

    insert into @t

    select 1,2,3,4,5 UNION ALL

    select 1,5,7,9,15 UNION ALL

    select 1,23,44,45,46...

  • RE: SQL Grouping

    As effective as the other one : )))

     

  • RE: SQL Grouping

    declare @t table(CategoryID int,AddressID int ,ProductID int)

    insert into @t

    select 1,2,3 union all

    select 1,2,4 union all

    select 1,2,5 union all

    select 2,2,4 union all

    select 2,2,5 union all

    select 1,3,7

    select CategoryID,count(*) DistinctAddresses

    from

     (select

     CategoryID, count(*)...

  • RE: Sum and Convert issue, query not working

    simpli because '01:45:00' is not an int

    you can convert to a datetime but not int

    you can get sum os seconds actully and you need to transform it back to...

  • RE: TSQL Performance Optimization GURUS Activate

    Right my mistake : ) didn't check well enaugh just copy paste ...and ups there goes a LITTLE (actually big) mistake

    Ya somehow the first plan force the optimizer to do the...

  • RE: Export Import

    sp_addlinkedserver  might help you

  • RE: TSQL Performance Optimization GURUS Activate

    From the plan it seems that he wants to do an ahead optimization and sort the join it actually does the join. The second one retrieve the result from t1...

  • RE: intersting sql puzzle

    DECLARE @spcname varchar(50)

    SET @spcname='Y'

    SELECT b.antim_id,anitm_name

    FROM

    (SELECT a.spcid,a.missile_id,b.spcname

    FROM Alien_CAPABILITY a INNER JOIN SPECIES b

    ON a.spcid=b.spcid

    WHERE spcname=@spcname) a

    INNER JOIN DEFUSE_CAPABILITY b

    ON a.missile_id=b.missile_id INNER JOIN ANTI_MISSILE c

    ON b.antim_id=c.antim_id

    GROUP BY...

Viewing 15 posts - 166 through 180 (of 321 total)