Forum Replies Created

Viewing 15 posts - 46 through 60 (of 154 total)

  • RE: AS clause/WHERE clause

    Hi,

    This query..

    select distinct id,

    count(id) as id_counter

    from x

    where id_counter > 1

    wouldnt work because you are using a aggregate in the select list - you need to use group by...

  • RE: How to remove Carriage Return from string?

    you have the parameters switched wrong

    also it might be a good idea to out the newline character too

    REPLACE(REPLACE(mystring,CHAR(13),''),CHAR(10),'')

  • RE: Need Help with CrossTab Report

    is this what you are looking for

    SELECT

    SD.permnum,

    SD.firstname,

    SD.lastname,

    SD.grade,

    TT.firstname AS TeacherFName,

    TT.lastname AS TeacherLName,

    SUM(CASE SC.TestShortName

    WHEN 'HMRP' THEN

    CASE

    WHEN SC.TestScore < 70 THEN SC.TestScore

    ELSE NULL

    END

    ELSE NULL

    END) AS PreTest,

    SUM(CASE...

  • RE: randomized update

    try this

    DECLARE @RandomValues TABLE

    (

    RandValint

    )

    DECLARE @Tbl TABLE

    (

    Idint identity,

    RandValint

    )

    INSERT INTO @RandomValues

    VALUES (1)

    INSERT INTO @RandomValues

    VALUES (4)

    INSERT INTO @RandomValues

    VALUES (6)

    INSERT INTO @RandomValues

    VALUES (10)

    INSERT INTO @Tbl (RandVal)

    VALUES (NULL)

    INSERT INTO @Tbl (RandVal)

    VALUES (NULL)

    INSERT INTO @Tbl (RandVal)

    VALUES...

  • RE: Backup with TSQL

    This script should list all directories for you

    USE PUBS

    DECLARE @CmdStr varchar(100),@PathName varchar(200)

    CREATE TABLE #Directories

    (

    DirectoryNamevarchar(100)

    )

    SET @PathName = 'C:'

    SET @CmdStr = 'DIR ' + @PathName + ' /A:d /B'

    INSERT INTO #Directories

    EXEC...

  • RE: How do I find size in KB of particular table in da

    EXEC sp_spaceused <tablename>

  • RE: Row updated?

    Have you considered using the BINARY_CHECKSUM(*) Function -

  • RE: Frequency within a specified time range

    very rough solution

    Returns the Keyholder with the start record for the specified period

    USE PUBS

    DECLARE @key TABLE

    (

    Tidint identity,

    KeyHolderchar(3),

    Accesseddatetime

    )

    INSERT INTO @key (KeyHolder,Accessed)

    VALUES ('AAA' , '2003-05-23 16:27:00.100')

    INSERT INTO

  • RE: lising a SUBSET of values

    you can use EXISTS

    SELECT ProductId

    FROM tblProduct

    WHERE EXISTS (

    SELECT 1

    FROM TblStoreInventory

    WHERE TblStoreInventory.ProductId = tblProduct.ProductId

    )

    --RETURN PRODUCTS IN INVENTORY

    SELECT ProductId

    FROM tblProduct

    WHERE NOT...

  • RE: Stored procedure does not work with some databases

    worked fine for me -

    didnt return records for tempdb and model- because it doesnt have any user tables.

  • RE: return value from exec(string)

    This one does not need a temp table

    USE PUBS

    DECLARE @STRnvarchar(200),

    @Parm nvarchar(20),

    @Cntint

    SET @STR = 'SELECT @Cnt= COUNT(*) FROM Authors'

    SET @Parm = '@Cnt int output'

    EXEC...

  • RE: joining 2 queries

    Looks like your joins are ther problem

    if you had rep 1 in reps

    and 10 recs in accounts for that rep +

    10 recs in seminars - you would get 1 *...

  • RE: Transaction Modes

    hmm...you are right - sorry should have checked what i was posting - my mistake

    Thanks

  • RE: User Define Function error

    Sorry,

    select @datestr = cast(year(@todate) as char(4)) + '-' + cast(month(@DOB) as char(2)) + '-' + cast(day(@Dob) as char(2))

    DOB might be a leap day as you said

    but todate is presumably...

  • RE: User Define Function error

    Might be a good idea to handle leap years here ..

Viewing 15 posts - 46 through 60 (of 154 total)