Forum Replies Created

Viewing 15 posts - 54,586 through 54,600 (of 59,067 total)

  • RE: Unstring text field?

    Heh... too bad I don't have SQL Server 2k5, yet... would be an interesting test 'cause, you're right, Regex is very fast.

    The fastest option, though, would be to have correctly...

  • RE: Delete Temp Table within a Cursor

    I agree... it seems like the called proc is for a GUI. If it's not too complex (or even if it is), you might want to consider rewritting it...

  • RE: Unstring text field?

    Agreed... 🙂

  • RE: Unstring text field?

    Great! Thanks for the feedback, Bob!

  • RE: Actual Reason to Use CLR

    jezemine (10/13/2007)


    this is unlikely, unless the DBA is uneducated about the CLR.

    any DBA that doesn't allow use of xp_cmdshell is likely not going to allow the import of...

  • RE: Determine field names of stored proc return

    What do you mean by "client side data table", Lowell?

  • RE: Table matching (tricky perhaps)

    When you get what you want, please post your solution. Thanks. 😉

  • RE: Combining Query Results

    Heh... you just need to look it in the eye... 😉

    [font="Courier New"]

    --=====&nbspThis&nbspis&nbspjust&nbspto&nbspbuild&nbspsome&nbspsample&nbspdata&nbspand&nbspis&nbspNOT&nbsppart&nbspof&nbspthe&nbspsolution

    DECLARE&nbsp@yourtable&nbspTABLE&nbsp(FromUser&nbspVARCHAR(10),&nbspToUser&nbspVARCHAR(10),&nbspDate&nbspDATETIME)

    &nbspINSERT&nbspINTO&nbsp@yourtable&nbsp(FromUser,&nbspToUser,&nbspDate)

    &nbspSELECT&nbsp'user1','user2',&nbsp'20070115'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user2','user1',&nbsp'20070116'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user2',&nbsp'20070117'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user3',&nbsp'20070118'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user3','user1',&nbsp'20070118'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user2',&nbsp'20070201'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user2','user1',&nbsp'20070205'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user2',&nbsp'20070301'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user3',&nbsp'20070310'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user3','user1',&nbsp'20070311'

    --=====&nbspThis&nbspis&nbspthe&nbspsolution

    &nbspSELECT&nbspd.FromUser,&nbspd.ToUser,&nbspd.YrMon,&nbspCOUNT(*)&nbspAS&nbspTimesConnected

    &nbsp&nbsp&nbspFROM&nbsp(--====&nbspDerived&nbsptable&nbspswaps&nbspusers&nbspwhen&nbspneeded

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspSELECT&nbspFromUser,&nbsp

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspToUser,

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspREPLACE(CONVERT(CHAR(7),Date,102),'.','-')&nbspAS&nbspYrMon

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFROM&nbsp@yourtable

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWHERE&nbspFromUser&nbsp<&nbspToUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspUNION&nbspALL

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspSELECT&nbspToUser&nbspAS&nbspFromUser,

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFromUser&nbspAS&nbspToUser,

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspREPLACE(CONVERT(CHAR(7),Date,102),'.','-')&nbspAS&nbspYrMon

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFROM&nbsp@yourtable

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWHERE&nbspToUser&nbsp<=&nbspFromUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp)&nbspd

    &nbsp&nbspGROUP&nbspBY&nbspd.FromUser,&nbspd.ToUser,&nbspd.YrMon

    [/font]

  • RE: Reading flat files from TSQL

    You really think filtering on an OPENROWSET would be faster than just importing the table?

  • RE: I need help with updating multiple columns in a table

    This isn't Oracle... no need to slow down the update with correlated subqueries like that... just do a simple join like some of the other posters have.

    Recommend you lookup UPDATE...

  • RE: Table matching (tricky perhaps)

    CASE WHEN a.col1 = b.col1 THEN 1 ELSE 0 END

    + CASE WHEN a.col2 = b.col2 THEN 1 ELSE 0 END

    + CASE WHEN a.col3 = b.col3 THEN 1 ELSE 0 END

    +...

  • RE: Combining Query Results

    Sure...

    [font="Courier New"]--=====&nbspThis&nbspis&nbspjust&nbspto&nbspbuild&nbspsome&nbspsample&nbspdata&nbspand&nbspis&nbspNOT&nbsppart&nbspof&nbspthe&nbspsolution

    DECLARE&nbsp@yourtable&nbspTABLE&nbsp(FromUser&nbspVARCHAR(10),&nbspToUser&nbspVARCHAR(10))

    &nbspINSERT&nbspINTO&nbsp@yourtable&nbsp(FromUser,&nbspToUser)

    &nbspSELECT&nbsp'user1','user2'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user2','user1'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user2'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user1','user3'&nbspUNION&nbspALL

    &nbspSELECT&nbsp'user3','user1'

    --=====&nbspThis&nbspis&nbspthe&nbspsolution

    &nbspSELECT&nbspd.FromUser,&nbspd.ToUser,&nbspCOUNT(*)&nbspAS&nbspTimeConnected

    &nbsp&nbsp&nbspFROM&nbsp(--====&nbspDerived&nbsptable&nbspswaps&nbspusers&nbspwhen&nbspneeded

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspSELECT&nbspFromUser,&nbspToUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFROM&nbsp@yourtable

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWHERE&nbspFromUser&nbsp<&nbspToUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspUNION&nbspALL

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspSELECT&nbspToUser&nbspAS&nbspFromUser,

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFromUser&nbspAS&nbspToUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFROM&nbsp@yourtable

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWHERE&nbspToUser&nbsp<=&nbspFromUser

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp)&nbspd

    &nbsp&nbspGROUP&nbspBY&nbspd.FromUser,&nbspd.ToUser[/font]

  • RE: SUBSTR - SUBSTRING function extension

    SQL Server has a LEFT and a RIGHT... no need to build a special function to do it as bad as Oracle 😉

  • RE: is this a good trigger?

    Sure... A thing called "Books Online" should become your best friend. One way of getting to it is to open Query Analyzer, click on the [Help] button, and select...

  • RE: SQL Code

    You bet... thank you for the feedback...

Viewing 15 posts - 54,586 through 54,600 (of 59,067 total)