Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 1,473 total)

  • RE: create a table name with a variable/parameter appended to end

    That error likely comes from this:

    SET @MasterName = 'MasterList'+@TableCount+''

    which needs to be:

    SET @MasterName = 'MasterList'+CAST(@TableCount as varchar(5)) +''

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: create a table name with a variable/parameter appended to end

    As Ninja said, views are normally used to solve this kind of issue.

    CREATE VIEW EmailList1

    AS

    SELECT *

    FROM EmailList

    WHERE ID < 10000

    CREATE VIEW EmailList2

    AS

    SELECT *

    FROM EmailList

    WHERE ID BETWEEN 10000 AND 19999

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: how to find week start date and end date from a given week number

    And what is week number? It could be defined in several different ways.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: how to find week start date and end date from a given week number

    Since many companies have their own dates for when weeks start and end (ie. payweeks, Thu - Wed, or Mon - Sun, etc), I normally generate a table that encompasses...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Updating Values Without Cursor

    My pleasure. Please let us know which ones end up performing the best in your environment.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Updating Values Without Cursor

    No problem. This is the method I was referring to:

    [font="Courier New"]DECLARE @ColA   VARCHAR(5),

       @ColID  INT

    UPDATE #MyTable

    SET    @ColA = ISNULL(ColA, @ColA),

       ColA = @ColA,

       @ColID = ColID

    FROM #MyTable WITH (INDEX(0))

    [/font]

    The key here...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Help with delete command

    Actually, he probably did. Jerry edited his post 😉 I make a habit of looking for that, as a lot of times people answer questions as edits to...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Converting Ansi Outer join to Newer Outer join

    It may not be. Old style outer join syntax confuses me. Conditions in your where clause are independent of your join structure. For instance, if you do...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: create a table name with a variable/parameter appended to end

    You can do it using Dynamic SQL. The more important question is why you need to do it at all. 40K rows is awfully small to look at...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Updating Values Without Cursor

    This can provide the solution you are looking for:

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/

    If you need me to help you get it working, I'd be happy to do so if you'd provide some sample data...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Querying Active Directory Using T-SQL

    Try this:

    SELECT givenName AS FirstName, sn AS LastName, uid as UserEmail, manager AS ManagerEmail

    FROM OPENQUERY (ADSI, 'SELECT givenName,sn,uid,manager FROM ''LDAP://LDAP.HP.com:389/ou=People,DC=hp,DC=com'' WHERE hpOrganizationChart=''Procurve*''')

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: t-sql using either table-a ot table-b

    Left Joins and a coalesce:

    SELECT COALESCE(A.Value, B.Value)

    FROM Source

    LEFT JOIN TableA A ON Source.ID = A.ID

    LEFT JOIN TableB B ON Source.ID = B.ID

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Correlated Query

    [EDIT]

    This was wrong. I was half asleep when I initially wrote it, and I get lazy when people don't provide DDL / Sample data. The following should work...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: DATEADD FUNCTION WITH TALLY TABLE GIVE OVERFLOW ERROR WITH MONTH

    Yep, I pasted it directly into QA on my SQL 2000 server and ran it. I get 61 rows returned.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: t-sql help/examples

    From what you've posted so far, I highly doubt you'll need a cursor for this. Read the post we're both talking about and try to give us as much...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 1,291 through 1,305 (of 1,473 total)