Forum Replies Created

Viewing 15 posts - 7,561 through 7,575 (of 7,602 total)

  • RE: Can anyone think of a good reason for NOT having a PK?

    Yes, if you want to add an index to a small table, and you should for many of them, always make it a unique, clustered index.  For example, for the sample...

  • RE: Set SysProcesses.Program_Name from OSQL or T-SQL?

    I thought the osql was a separate process and so would get its own spid.  How will you know which row in the table the child process needs to get?

  • RE: REPLICATE() beyond 8000 bytes

    Probably easiest is to do something like this (handles up to 24000, assuming PRINT can handle that):

    print space(@hangingIndent) + replicate(@startCharacter, CASE WHEN @widthOfPattern > 8000 THEN 8000 ELSE @widthOfPattern END)...

  • RE: Can anyone think of a good reason for NOT having a PK?

    >> I suggest you make them both nonclustered indexes. Your inserts and queries will move along alot faster. <<

    That depends on the queries.  For example, if you always specify a...

  • RE: New Column Updates

    Very interesting article, definitely worth seeing.

    Btw, though, shouldn't the columns be NCHAR(2) instead of NVARCHAR(2)?  It's a waste of space and processing overhead to make a 2-byte column variable.

  • RE: Sic Semper NULL

    Excellent article!

    Regarding the commission example, to consider something specific, I would prefer to explicitly know that a commission does not apply.  Therefore, I might add a "IsCommissionEligible" BIT column.  This is, most...

  • RE: Missing Stored Proc Text in syscomments table

    You also need to add an ORDER BY, otherwise you can't be sure the code rows will be returned in sequence:

    SELECT ...

    ORDER BY id, colid

  • RE: Is it possible to format a COMPUTE clause?

    If the base table is small, you can do this:

    SELECT *

    FROM #tmpSumTest

    UNION ALL

    SELECT CAST(SUM(number) AS DECIMAL(19, 8))

    FROM #tmpSumTest

    If not small, you can make the main query a subquery, adding...

  • RE: database table search

    Yes, you'll have to change the query for that.

    To get tables with '%school%' in them:

    1) AND must match all the other criteria, do this:

    WHERE o.name LIKE N'%school%'

    AND o.xtype = ''U'' AND o.name...

  • RE: database table search

    D'OH, sorry, change the TINYINTs to SMALLINTs.

  • RE: database table search

    I assume you know the column type is char/varchar/nchar/nvarchar.  If not, remove the check for "%char%"; if you know it's varchar, naturally you can change it to "%varchar%".

    For one db:

    SELECT...

  • RE: Please allow feedback on "Script of the Day"

    > Kill connections is pretty good. <

    No, it's not - ALTER DATABASE should be used.

    And if you really want  to issue specific KILLs, you can do it something...

  • RE: Structure of SP results

    Sorry, correct, I mis-read the original q.

  • RE: Structure of SP results

    Try looking at table "syscolumns".  It includes not just table columns but also stored procedure columns .

    For example:

    SELECT *

    FROM syscolumns WITH (NOLOCK)

    WHERE id...

  • RE: Facing problem with executing large-value query variable

    Change @Qry from VARCHAR(5000) to VARCHAR(8000).

Viewing 15 posts - 7,561 through 7,575 (of 7,602 total)