Forum Replies Created

Viewing 15 posts - 48,571 through 48,585 (of 49,552 total)

  • RE: filter by data type?

    Be careful with IsNumeric. It returns true for some values that cannot be converted to int.

    SELECT

    ISNUMERIC('1,234.00'),

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: getting error "“Invalid object name ''''SizeMst''''. “ " while exec sp

    Stupid questions, I know, but have you checked to make sure that

    1) The table is there

    2) The name is spelt correctly

    3) It's in the dbo schema

    4) If your db is...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: AFTER INSERT Failure Rollbacks entire batch

    Your trigger is assuming there's only one row inserted. If there's more than one, the not exists could return true (for 1 of the records) but on another there's a conflict.

    Try...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to find current SQL Server network alias with T-SQL

    I'm not a network expert either. You might have to do a DNS lookup from the command prompt, using xp_cmdshell, then parse the results of that.

    You could try ping....

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Deadlock on simple update on different rows

    What you can try, as a last resort, is to add WITH (ROWLOCK) to the update statement. I don't normally suggest hints as SQL usually does a good enough job...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to write switch case scenario in sp

    A case statement in SQL can only be used within a select/update statement. It can't be used for control flow in the procedure. For the latter, use IF statements.

    The form...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Deadlock on simple update on different rows

    The lock requests are on a RID. That's not possible if there's a clustered index on the table in question. RIDs (Row Identifiers) only exist in heaps.

    Can you post the...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Deadlock on simple update on different rows

    See if you can get traceflag 1204 switched on. That outputs the details of the deadlock to the error log, including both nodes and what resource they were deadlocked on.

    If...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to find current SQL Server network alias with T-SQL

    SELECT @@Servername and SELECT serverproperty('MachineName') will get you what SQL thinks the machine name is. Typically, this is the name the machine had when it was installed, though it can be...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: rowcount of subquery

    Ah, so it's an auto-generated query.

    A transaction is not considered one statement, and you're right, the CTE would be gone by the second select. Since this is auto generated, try...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: rowcount of subquery

    Perhaps insert the subquery portion into a temp table (or use a CTE), then you can use that in the outer query and again to get the rowcount.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: rowcount of subquery

    You might be able to use ROW_NUMBER().

    In your subquery, include another field ROW_NUMBER() OVER (Order BY ....) AS RowNo and give it any of the fields. Then if you can get...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: MSDBA Certification

    I used the following book as partial prep for the 70-441 exam (Database solutions design) and I would highly recomend that others do NOT do the same.

    http://www.amazon.com/MCITP-Developer-Microsoft-Database-Solutions/dp/0470040521/ref=sr_1_1/105-4139392-2116416?ie=UTF8&s=books&qid=1183538693&sr=1-1

    The book is...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to assign result of a EXEC into a local variable

    look up sp_executesql

    declare

    @stuff int , @sql nvarchar(1000)

    EXEC

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: BCP command using TSQL without xp_cmdshell

    You could schedule it as a OS task in sql agent. Other than that, I don't think there's a way to run an OS command without xp_cmdshell (unless you create...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 48,571 through 48,585 (of 49,552 total)