Forum Replies Created

Viewing 15 posts - 2,251 through 2,265 (of 3,232 total)

  • RE: output variables

    CREATE PROCEDURE dbo.OutputTest @Year int OUTPUT, @Year1 int OUTPUT, @Year2 int OUTPUT

    AS

    SELECT @Year = 2006,

        @Year1 = 2005,

        @Year2 = 2004

    GO

    DECLARE @returnValue int,

        @returnValue1 int,

        @returnValue2 int

    EXEC dbo.OutputTest @returnValue OUTPUT,@returnValue1...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Ranking records in query results

    Mark,

    Keep in mind that the UNION statements are only there to populate the initial test data for the example.  That test data is then used in place where your...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: IDENTITY_INSERT and SELECT *

    In addition to what Lynn has posted:

    It looks like you are performing this action on a number of tables hence the dynamic SQL.  Don't forget to set the IDENTITY_INSERT back...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Getting select records from one tabel to another

    INSERT INTO Table3 (<column list&gt

    SELECT <your select that you used to identify the 30,000 missing rows>

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: INsert 0 instead of NULL

    I would go with Matt's suggestions as COALESCE is the ANSI preferred method as opposed to ISNULL.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: What needs done to get cursor out of un needed loop

    You need to add another fetch next into your begin/end block like so:

    CREATE TABLE #backupmissed(dbname VARCHAR(50),lastbackup VARCHAR(21))

    SET ansi_warnings OFF

    SET NOCOUNT on

    DECLARE @names VARCHAR(30)

    INSERT INTO #backupmissed(dbname,lastbackup)

    SELECT A.database_name as 'DBName',

        A.backup_finish_date...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: LIKE%

    I'm still not exactly sure what you're after but here you go:

     

    DECLARE @table TABLE (value varchar(100))

    INSERT INTO  @table

    SELECT 'Please help me because I cant help myself' UNION ALL

    SELECT 'u...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: LIKE%

    Can you provide an example of what you are trying to do and include sample data and results?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Help with Query

    SELECT AuditDateTime,

        SUM(COALESCE(ColA,0)) AS colA,

        SUM(COALESCE(ColB,0)) AS colB,

        SUM(COALESCE(ColC,0)) AS colC

    FROM #a

    GROUP BY AuditDateTime

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Calendar and Business day functions

    Create a calendar or dates table.  Do a search on SSC for calendar table or dates table.  There are many threads on this topic.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Ranking records in query results

    Great post Jeff.  I wanted to run through a test after David posted the question of performance, but I didn't have the time to get one put together.  I did...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: User Specific Persistent Temporary Table

    Because the temp table resided in TempDB, you will not be able to rename the table using sp_rename as sp_rename will not allow you to...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: Last Time An SP Was Run

    Unless there is logic within your stored procedure to write a run history to an audit table, there is really no way to know the last time a SP has...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • RE: converting a column from int to char

    1. Drop all foreign keys and constraints on the affected columns. 

    2. Run ALTER TABLE <tableName> ALTER COLUMN <columnName> [char].... commands for each table/column to change.

    3. Re-create all constraints.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

    Steve is correct, a heap in SQL Server is a table without a clustered index.  If you look in BOL at Table and Index Architecture, it shows that there are...

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

Viewing 15 posts - 2,251 through 2,265 (of 3,232 total)