Forum Replies Created

Viewing 12 posts - 7,606 through 7,618 (of 7,618 total)

  • RE: Generating a Sequential Pattern

    Yes.  Or possibly even a single identity column that was re-seeded each year to yy00000[0]; the "-" could be added prior to display just for the "visual effect" for the user. ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Practical Uses of PatIndex

    Don't see any need for the "IF" at the start of the function.  I wrote an almost identical function for this purpose but with just the WHILE.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: check that a column exists or not on a table

    To check for existence of a column, don't think you need to do a system table query at all, just use a built-in SQL function:

    IF COL_LENGTH ('tableName', 'columnName') IS NULL

        --column...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: TSQL question

    DECLARE @v-2 VARCHAR(200)

    SET @v-2 = 'http://www.google.com/intl/en/images/logo.gif'

    SELECT SUBSTRING(@v, CHARINDEX('//', @v-2) + 2, CHARINDEX('/', @v-2, CHARINDEX('//', @v-2) + 2) - (CHARINDEX('//', @v-2) + 2))

    --That will work for *any* string prior to the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Self selects galore - better way? subselects?

    Something like this should perform *much* better

     

    SELECT     a.procid, b.[ClientName] AS CName, b.[CompanyName], b.[CustRefNum] AS CRef,

                      b.[JobNumber] AS JNumber, --...,

                         b.[County] AS RCounty

    FROM      ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question of the Day for 02 Jun 2005

    When you run code #1, it actually does seem to work, although I'm not exactly sure why it would.  Since punctuation falls within that range, it really shouldn't.  You can run...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question of the Day for 02 Jun 2005

    I agree with Tim 100%.  The code suggested would not necessarily work and presumably would be less efficient than a not check.  Very frequently when the qod is a T-SQL...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question of the Day for 04 Jun 2004

    I assumed that too and got it right, but why not make the question match the answer:

    Bill needs to show the day of the week for today's date on a...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question of the Day for 04 Jun 2004

    Silly premise for the question, since it would require that the highest sales always occur on the current day.  Just don't try rerunning the report

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Need Help removing leading tab

    I think you can remove leading tab(s) directly within a SELECT, without any CASE or loop, for example:

    DECLARE @tabPattern VARCHAR(8)

    SET @tabPattern = '%[^' + CHAR(9) + ']%'

    DECLARE @tabRemove VARCHAR(200)

    SET @tabremove...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question of the Day for 04 May 2004

    I would prefer simply:

    CHECK(minit LIKE '[ A-Z]')

    Why split it into two checks?

     

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Crosstab aggregate error, A Stumper!

    You do understand that multiple CASE conditions could be true for the same value and that a single value could be added to every total?

    For example, if cas_lbs...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 12 posts - 7,606 through 7,618 (of 7,618 total)