Forum Replies Created

Viewing 15 posts - 9,511 through 9,525 (of 10,144 total)

  • RE: Re: Short-circuiting a query

    Spooky, Grant. Very spooky 😎

  • RE: Re: Short-circuiting a query

    This should do the trick:

    [font="Courier New"]DECLARE @brand_id INT

    IF @brand_id IS NOT NULL

    BEGIN  

       SELECT p.pk_product_id

       FROM tbl_brands b (NOLOCK)

       INNER JOIN tbl_products p ON p.fk_brand_id = b.pk_brand_id

       WHERE b.fk_brand_map_id = @brand_id...

  • RE: Join three tables and

    Duleep Nagahawatte (9/26/2008)


    This does not give me all the data from table one! I tried this! Also i tried it with brackets! No luck!

    Here's the solution kindly and expertly provided...

  • RE: CONVERT from minutes to hours

    Philip Horan (9/25/2008)


    Hi. If a user inputs 8 the the field holds the value as 480:00000.If user enters 15 then 15:00000

    Thanks,

    Phil.

    Are you absolutely sure of this, Phil?

  • RE: Strings with apostrophes

    Gareth, how about posting a real example of a statement which would cause a crash as you describe? There are numerous ways of dealing with embedded single quotes - Madhivanan...

  • RE: Error 8144 - Too Many Arguments Specified

    You're welcome Sergio, thank you for your feedback.

  • RE: Strings with apostrophes

    garethmann101 (9/29/2008)


    No, much better to get rid of the apostraphes from the outset I do not need them at all.

    "O'Conner" becomes "O Conner", that is a much better solution...

  • RE: Error 8144 - Too Many Arguments Specified

    Hi Sergio

    I can't see why you are getting an error, however I can see that only one SELECT is required to fetch the data for your history table:

    [font="Courier New"]USE [wce_sqlexpress]

    GO

    /******...

  • RE: Cumulative Values

    Hi Raj

    Check out this article http://www.sqlservercentral.com/articles/Advanced+Querying/61716/, it describes in some detail how to do running totals. If you have difficulty with the article or with your specific problem, then repost....

  • RE: Inserting into a table with only identity column

    Unless there's a very good reason to perform this task in two separate steps, use only one:

    [font="Courier New"]SELECT TOP 20 IDENTITY(INT,1,1) AS test_id

    INTO #test

    FROM MASTER.dbo.syscolumns sc1,

       MASTER.dbo.syscolumns sc2

    SELECT * FROM...

  • RE: Stored Procedure Not Returning Values

    Hi Mark

    As Gail and Jeff have already suggested, change your joins to LEFT JOINS:

    [font="Courier New"]SELECT  h.ListingID, h.FullAddress,

       c.ListingID, c.Person, c.Email, c.Phone,

       e.ListingID, e.Beds, e.Baths, e.Style, e.Footage, e.[Description],

       t.ListingID,...

  • RE: A case with GROUP BY

    SprocKing (9/29/2008)


    Why do summersaults with the date like that? The convert() function works well. One of my favorite uses is for the 'YYYYMMDD' output using 112 as the input "style"...

  • RE: SELECT

    Hi Bo

    Thanks for providing the whole query. The next job is to identify joins which can be changed from OUTER to INNER, which will shift the run duration back towards...

  • RE: SELECT

    Bo, we're a little short on information here - as an absolute minimum, would it be possible for you to post your query? All of it?

    Cheers

    ChrisM

  • RE: Effects of using Derived Table

    Jerry Hung (9/24/2008)


    For your code

    the derived table FIRSTRUN will return ALL results, since you didn't put a WHERE condition in there

    easiest way: select the actual code inside the ( .......

Viewing 15 posts - 9,511 through 9,525 (of 10,144 total)