Forum Replies Created

Viewing 15 posts - 31 through 45 (of 192 total)

  • RE: select rows based on lowest value

    Something like this would probably do the trick.

    SELECT m.id, m.sequence, t.name
    FROM (
            SELECT ID, MIN(sequence) AS Sequence
          ...
  • RE: Help.....This runs so slow

    There have been some good suggestions above and, like others have said, you definitly don't want the distinct in your subquery there. If this is still an issue and...

  • RE: Help.....This runs so slow

    As an aside, it's worth nothing that IN/NOT IN (with a subquery), EXISTS/NOT EXISTS, INTERSECT/EXCEPT almost always perform better than an equilivent operation implemented with an INNER or LEFTER OUTER...

  • RE: How does this work?

    I've always prefered the more concise:

    DECLARE @recipients varchar(8000)
    SELECT @recipients = COALESCE(@recipients + ';','') + COALESCE(email, '') FROM staff
    SELECT @recipients
    

    Using this code, you don't have a trailing semicolon and you don't...

  • RE: Need Suggestion (working query) there

    You could change your starting if statement to check table existence using something like:

    IF EXISTS(SELECT * FROM information_schema.tables WHERE TABLE_NAME IN(''...''))
    BEGIN
    ...
    
  • RE: Using SP & TMP tables in place of multiple views

    How tied are you to these views? I know you need to retain the logic. But are you at a point where these views? You said that you were asked...

  • RE: Size of VarChar DataType

    The most likely cause of your issue is that you are concatenating values that are not VARCHAR(MAX) into a VARCHAR(MAX). You must explicitly convert values that are not stored as...

  • RE: Using SP & TMP tables in place of multiple views

    It seems to me that replacing those views with global temp tables would be a really bad idea. You definitely do not want several denormalized copies of your database in...

  • RE: Get one line from sp_helptext

    Aaron,

    Do be aware that Mohammeds code could potentially overlook procs you wish to drop. You cannot always accuratly look for procs in syscomments by using a where clause such as...

  • RE: Calling procedure / trigger

    Anytime! Glad I could help

  • RE: concatenation binary to char

    Actually, what I think you want is:

    DECLARE @mybin1 binary(16)
    
    SET @mybin1 = 0x098F6BCD4621D373CADE4E832627B4F6
    
    SELECT @mybin1
    select sys.fn_varbintohexsubstring(0, @mybin1,1,0)
    
  • RE: Get one line from sp_helptext

    Very nice solution Scott, especially the detail of qualifying the object name!

    Be aware, though, that INFORMATION_SCHEMA.ROUTINES only stores the first 4000 bytes of the SPROC text. If you are searching...

  • RE: concatenation binary to char

    As far as suggestions go, You can use

    select master.dbo.fn_varbintohexstr(@mybin1)

    Be aware that fn_varbintohexstr is and undocumented function, and thus

    unsupported and may not be included in future versions of SQL Server.

    As far...

  • RE: Email broadcast optimization

    You can definitely make this significantly faster.

    Is your read query being blocked by your write query?

    How often is your broadcastemails table being updated?

    What locks are being acqired?...

  • RE: Calling procedure / trigger

    There are a couple of possibilities that I know of.

    Yousef Ekhtiari wrote a great article about using

    CONEXT_INFO

    to acomplish something like that (http://www.sqlservercentral.com/columnists/yEkhtiari/2765.asp).

    You can also query

    DBCC...

Viewing 15 posts - 31 through 45 (of 192 total)