Forum Replies Created

Viewing 15 posts - 54,601 through 54,615 (of 59,078 total)

  • 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...

  • RE: Bulk Insert

    Could be any of a dozen different problems... you need to post the code you're using and the CREATE statement for the table you are importing to.

  • RE: Actual Reason to Use CLR

    Grant, I'm with you... I see no compelling reason for CLR's. My opinion, for the most part, for them being there is the same as DTS and Cursors... they...

  • RE: Unstring text field?

    The easiest way to split limited (up to 4 parts) period-delimited text of this nature is to use PARSENAME. Look it up in Books Online for a full explanation.

    Here's...

  • RE: query statistics

    This is very nearly a duplicate post...

    http://www.sqlservercentral.com/Forums/Topic410280-65-1.aspx

    The only thing that means anything about performance for all the timers you have here is this...

    Number of TDS packets received 28569 28569

    Number of...

Viewing 15 posts - 54,601 through 54,615 (of 59,078 total)