Forum Replies Created

Viewing 15 posts - 2,206 through 2,220 (of 3,544 total)

  • RE: Question of the Day for 29 Aug 2005

    I wonder if you get overflow or page faults

    Only joking, lol

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Show only unanswered questions?

    That's twice then

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question of the Day for 29 Aug 2005

    quotefor me, it means single dimension

    Well, I'd hate to see how long your piece of paper is...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Show only unanswered questions?

    Well, sushila, you're heaping so many on Remi (must have broad shoulders or a large back) thought there might be a few for me

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Show only unanswered questions?

    Mine would be cockupR'us

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Hate cursors? Are you a genius query optimizer?

    Another alternative

    CREATE TABLE #temp (Location int,Item int,SalesWeek int,Qty int)

    INSERT INTO #temp (Location,Item,SalesWeek,Qty)

    SELECT Location,Item,SalesWeek,MAX(Qty) FROM [#Table]

    GROUP BY Location,Item,SalesWeek

    SELECT a.Location,a.Item,a.SalesWeek,a.Qty FROM #temp a

    UNION

    SELECT b.Location,b.Item,b.SalesWeek,MAX(b.Qty)

    FROM [#Table] b

    INNER...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Hate cursors? Are you a genius query optimizer?

    Maybe

    SELECT a.Location,a.Item,a.SalesWeek,a.Qty

    FROM [Table] a

    WHERE EXISTS (SELECT 1

    FROM (SELECT TOP 2 x.Location,x.Item,x.SalesWeek,x.Qty

    FROM [Table] x

    WHERE x.Location=a.Location AND x.Item=a.Item AND x.SalesWeek=a.SalesWeek

    ORDER BY x.Qty DESC ) y

    WHERE...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question of the Day for 29 Aug 2005

    I'll raise your pedantic with a pedantic, the query does not return a table but a recordset

    The recordset can be interpreted as a table...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query HELP...

    Provided the AtachmentID's are sequential for each MsgID (and start at 1) then you could try this

    DECLARE @maxid int,@count int,@sql nvarchar(1000),@countstr varchar(10)

    SELECT @maxid = MAX([AttachmentID]) FROM t_Attachments

    CREATE TABLE #temp ([MsgID]...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: TOP create syntax error

    Not quite true. TOP keyword is SQL7 (level 70) onwards only and the error is a symptom of compatabilty albeit the poster says it is not.

    Remi, your code works because of the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query HELP...

    If there are only 2 attachments then

    SELECT

    a1.AttachmentID AS [AttachmentID1],

    a1.MsgID AS [MsgID1],

    a1.[FileName] AS [FileName1],

    a1.AttachmentContents AS [AttachmentContents1],

    a2.AttachmentID AS [AttachmentID2],

    a2.MsgID AS [MsgID2],

    a2.[FileName] AS [FileName2],

    a2.AttachmentContents AS...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Is it possible to create a temp table with dynamic columns?

    Monthly below and does 1 month from the start date.

    Depending on what Quarterly means you could revise this accordingly

    DECLARE @NoofDays int, @StartDate char(8), @sql varchar(4000)

    SET @StartDate = '20050801'

    SET...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Externalizing TSQL Code

    try

    exec sp_executesql @sql, N'@CDM nvarchar(1)', @CDM

    instead of the exec

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Sort numerically from an alphanumeric column

    Just for fun

    ISNULL(STUFF(STUFF(SOR_CODE,PATINDEX('%[0-9][a-z]%',SOR_CODE)+1,LEN(SOR_CODE),''),1,PATINDEX('%[0-9]%',SOR_CODE)-1,''),'')

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Is it possible to create a temp table with dynamic columns?

    Try this

    DECLARE @Mode varchar(10), @StartDate char(8), @sql varchar(4000)

    SET @Mode = 'Weekly'

    SET @StartDate = '20050804'

    SET @sql = '

    DECLARE @StartDate datetime SET @StartDate='''+@startdate+''' SELECT DISTINCT 1,l.ResourceDesc,l.ResourceDesc AS [Desc]'

    SELECT @sql...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,206 through 2,220 (of 3,544 total)