Forum Replies Created

Viewing 15 posts - 9,526 through 9,540 (of 10,144 total)

  • RE: How to update and select the updated records in a single T-Sql statement

    They're kisses - but in this context they can be understood as a big-hearted "Thank you kindly".

    Or maybe you just got lucky - better grab your coat JIC 😎

  • RE: Formatting...date output

    You will need to cast your return value as CHAR (or VARCHAR) if you want an embedded non-numeric character:

    [font="Courier New"]DECLARE @weekNum INT, @WeekName CHAR(7)

    SET @weekNum = 200843

    SET @WeekName = STUFF(CAST(@weekNum...

  • RE: Count between two days

    Hi Ram

    I'm not exactly sure what you're looking for: whether it's start and end date in the same row to get the days difference between the two, or to perform...

  • RE: Divide by zero error encountered......

    Hi b_boy

    The part in bold is evaluating to zero for some rows:

    (100.*

    sum(case datepart(yy,t.orderdate) when 2008 then 1. else 0. end) /

    ...

  • RE: select from GETDATE()?

    Madhivanan, quite right! I don't know why the conversion I posted is being used - possibly from a previous version. It's used extensively here to generate a suffix for export...

  • RE: select from GETDATE()?

    SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 102), '.', '')

  • RE: Add 1 to integer Field

    You're welcome Gareth, many thanks for the feedback.

  • RE: Add 1 to integer Field

    Hi Gareth

    A really useful habit to get into is to always SELECT whatever you're intending to UPDATE first. If you run a simple SELECT...

    SELECT myColumn

    FROM tbCities08

    WHERE Unique_ID = 020001000080

    ...you will...

  • RE: getting values for current day using getDate() functon

    Hi mpeters

    Here's the theory:

    Get the current datetime using getdate()

    Strip off the time component, which gives today

    Add a day to the result, which gives tomorrow with no time component:

    [font="Courier New"]DECLARE...

  • RE: Help on Dups

    Now I gotcha, thanks for the extra explanation.

    [font="Courier New"]DECLARE @Table TABLE (

            [id] bigint IDENTITY PRIMARY KEY CLUSTERED,

            lang VARCHAR(100),

            code CHAR(1) )

    INSERT @Table

    SELECT 'en','A' UNION ALL -- 1

    SELECT 'en','A' UNION ALL --...

  • RE: Conditional logic in a view

    Thanks for the feedback Robb 🙂

  • RE: Help on Dups

    Hello

    Try this out, have a look at the result set (it will contain all the iterations of the dupes) and use it to help explain what you're trying to do.

    [font="Courier...

  • RE: Conditional logic in a view

    rhagan (9/22/2008)


    ChrisM-

    The same table as the view references contains the field that will determine the what the user can see.

    Example:

    SELECT t.*

    FROM TABLE t

    WHERE t.deletedate IS NULL

    AND ((IS_MEMBER('role') = 0

    ...

  • RE: Conditional logic in a view

    rhagan (9/22/2008)


    ChrisM-

    The original purpose of this view was to exclude records stamped as delete - deletedate IS NULL.

    So these records need to be exlcuded no matter which role the user...

  • RE: Populating an IDENTITY column

    Andrew Gothard (9/22/2008)


    Or, have an NMR Number, plus an Identity column.

    From moving over to the new system, NMR = the Identity column for all new values with the Identity column...

Viewing 15 posts - 9,526 through 9,540 (of 10,144 total)