Forum Replies Created

Viewing 15 posts - 121 through 135 (of 346 total)

  • RE: How to Restore one .BAK to 2 Different Databases

    If the Pbfamily_new database already exists on your system, either drop it first or run this:

    [font="Courier New"]RESTORE DATABASE Pbfamily_new

    FROM DISK = 'C:\SQL-Backups\pbfamily\pbFamily_db_200805040200.BAK'

    WITH MOVE 'PBFamily_Data'...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Statistics in all Databases

    This is even more helpful - code that actually updates stats in all databases. My bad, I missed that the first sp_executesql statement changes the context, but only for...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: SQL Server Agent wont start

    I just did some testing and got the same results - SQL Server Agent wouldn't start after setting an alias. I didn't have to reinstall, however. Here's what...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: sql server default username and password

    1. There is no default user/password per se. By default, BUILTIN\Administrators is granted sysadmin role, so any local administrator will be able to log in.

    2. Make sure...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Statistics in all Databases

    This will work:

    EDIT: No it won't! Bad code removed. See my next post.



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: IF Statement for sending email via Database mail

    You don't need [font="Courier New"]END[/font] with an [font="Courier New"]IF[/font] statement, only with the [font="Courier New"]CASE[/font] statement. Unless you are doing multi-line code blocks for the statement blocks. So...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: DDL Triggers

    Not as such. Some DDL triggers have server-level scope, some have database-level scope. So you can't create a server-level trigger to capture all ALTER TABLE statements, for example.

    For...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: "Cannot Generate SSPI Context" when using account in another domain

    That would be my first guess - check/create SPNs for your SQL Server(s). I had to do it recently with the setspn utility (different circumstances but same error message)....



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Error adding Foreign Key

    Add the WITH NOCHECK clause.

    [font="Courier New"]ALTER TABLE [dbo].[SearchItemWord] WITH NOCHECK

    ADD CONSTRAINT [FK_SearchItemWord_SearchItem] FOREIGN KEY

    (

    [SearchItemID]

    )

    REFERENCES [dbo].[SearchItem]

    (

    [SearchItemID]

    ) ON DELETE CASCADE ON UPDATE CASCADE [/font]



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Track down runaway CPU spikes

    First thing we do is open two copies of perfmon. The first one, we add the % Processor time per thread counters (see PerfMon01.jpg) and switch to Chart/Histogram view....



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Differential Backup Files

    Doesn't matter about the versions.

    Not sure about the other, though. Try it and see what happens.



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: SQL 2005 Query Help Needed

    As stated in my previous post, I use nvarchar because sp_executesql only accepts unicode data. From BOL:

    [font="Arial"][ @stmt = ] stmt

    Is a Unicode string that contains a Transact-SQL statement...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Internet requirements

    An internet connection is not necessary.

    There is a gotcha regarding SQL Server 2005 SP1 and Integration Services. SSIS will not start because it is trying to reach crl.microsoft.com to...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Track down runaway CPU spikes

    Here's some revised code that returns the SPID and does a DBCC INPUTBUFFER all in one step:

    [font="Courier New"]USE master

    GO

    -- returns SPID & DBCC INPUTBUFFER for a given kpid

    DECLARE @sql nvarchar(1000),...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • RE: Track down runaway CPU spikes

    No, the first perfmon instance (in Histogram view) shows you which SQL Server thread is hogging CPU use. Each thread is assigned a number, so you have sqlservr/1,...



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


Viewing 15 posts - 121 through 135 (of 346 total)