Forum Replies Created

Viewing 15 posts - 6,031 through 6,045 (of 13,469 total)

  • RE: DMVs go how far back?

    it depends on WHICH DMV also;

    sys.dm_exec_connections are only valid while the spid is connected, i think;

    sys.dm_db_index_usage_stats is good until a stop start,

    but i think sys.dm_exec_query_plan would get cleared...

  • RE: Replace (--)

    i'm guess it's more complicated than the original post's simple REPLACE function

    ...for example if he's trying to replace stored procedure text, but there's code that does something like ISNULL(Category,'--');

    he cannot...

  • RE: How to handle sql server stored procedure output parameter in .bat file

    well, SQL server has no problem returning negative numbers...maybe it's a command line limitation?

    CREATE PROCEDURE checkstate @param int

    AS

    return @param;

    GO

    DECLARE @return_status int;

    EXEC @return_status = checkstate -1;

    SELECT 'Return Status' = @return_status;

    GO

  • RE: List all user databases the perform operation on each one

    all the databases can be selected from master.sys.databases;

    SELECT * FROM master.sys.databases

    WHERE database_id > 4 --skip master/tempdb/model/msdb

    i would probably generate my list of commands from that same sql, and execute the...

  • RE: Best way to return a 1 or 0 for an if exists query

    i think you can do it inline with a sub select, like this without using an If structure:

    CREATE Procedure [dbo].[sp_GGA_Testing]

    @status int,

    @ID int

    As

    SELECT ISNULL(ExistsVal,0)

    FROM

    (select 1 AS ExistsVal

    from tblONE

    where ID...

  • RE: unable to bring database in single user mode

    if you use the optional WITH ROLLBACK IMMEDIATE, it will disconnect everyone from the database.

    ALTER DATABASE Logging_demoSP2 SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    --do some exclusive stuff, like RESTORE

    --if the database as...

  • RE: How to get text output from a scheduled sp on 2005 to a file

    Random Visitor (1/23/2012)


    We don't have SSIS installed so is there any way a Job can be run to direct the output from an executed sp to a text file on...

  • RE: Single DB vs 2 DBs

    how you need to report or aggregate the information may play a factor; also whether they ever reference each others data.

    the data is really independent of each other, right? there's...

  • RE: Almost a Delimited Split kind of Join?

    Thanks Mark, but i think that won't quote work;

    in the full table, i have more paths than just the "Program Files\Microsoft SQL Server" path example, many other paths might have...

  • RE: sp_MSforeachtable

    ahh didn't know you were in SQL 2000; didn't read the forum.

    max has no practical limit, but is SQL2005 and above, sorry.

    maxsize in SQL2000 is NVARCHAR(4000) for an NVARCHAR; and...

  • RE: sp_MSforeachtable

    do you need the results on a per table command?

    i've done something similar by building the string and executing it:

    DECLARE @mycommand1 nvarchar(max);

    SET @mycommand1=''

    SELECT @mycommand1 = @mycommand1

    + N'DBCC...

  • RE: Encrypted fields

    durai nagarajan (1/20/2012)


    Hello,

    This DB was not built by me. SQL 2005 DB.

    Basics Employee code, name and certain things are encrypted in this DB.

    None of the table has primary key,...

  • RE: Compute table column based on other columns by month

    Ninja's_RGR'us (1/20/2012)


    Ehh, why not sum(case) ???

    duh...err...no excuse. that's the right solution.

    not thinking straight.

  • RE: Compute table column based on other columns by month

    we'd really need to see the DDL of the table that the data gets extracted from to offer more than a suggestion or prototype.

    I'd create a view instead that joins...

  • RE: SQL Server Collation (ASCII Table sort and Case Insensitive/Accent Insensitive)

    well i couldn't figure out what order you wanted via your example;

    lets switch to real code so we can figure it out better.

    does this do what you want? what's wrong...

Viewing 15 posts - 6,031 through 6,045 (of 13,469 total)