Forum Replies Created

Viewing 15 posts - 16 through 30 (of 48 total)

  • RE: Is sp_executesql reliable?

    Much appreciated, Ive read from somewhere if I use QUOTENAME(@FieldName,'''') with 4 single quotations, it makes stored procedure bullet proof from sql injection, but Im still in doubt if its...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Validate trigger entries

    Ville-Pekka Vahteala (12/22/2013)


    Couple of things.

    Can't you just use constraints?

    Your posted code seems to assume that there will be just one row coming to trigger, which might not be the case.

    Thank...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Validate trigger entries

    Ville-Pekka Vahteala (12/22/2013)


    Couple of things.

    Can't you just use constraints?

    Your posted code seems to assume that there will be just one row coming to trigger, which might not be the case.

    Well,...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Validate trigger entries

    I found this message:

    The transaction ended in the trigger. The batch has been aborted.

    Is because "ROLLBACK TRANSACTION".

    If we don't want above message we have to remove "ROLLBACK TRANSACTION" and validate...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Is sp_executesql reliable?

    Much appreciated, I think you've gave me enough clue.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Date Conversion error: out of range

    This query works fine:

    DECLARE @dt CHAR(8)

    SET @dt = cast(MONTH(getdate()) as char(2)) + '01' + cast(year(getdate()) as char(4))

    SELECT CONVERT(datetime,RIGHT(@dt,4)+LEFT(@dt,2)+SUBSTRING(@dt,3,2),112)

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Give priority to union statements

    Much appreciated Gail Shaw.

    Thank you very much.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Sql force me to include Row_Number() in group by

    After several hours of thinking if seems using min(ID) solve problem

    WITH CTE(Col1, Col2, Row_Num) AS (

    SELECT Col1 ,SUM(Col2), ROW_NUMBER() OVER(ORDER BY (MIN(ID)))

    ...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Group by without soring

    siggemannen (9/14/2013)


    Try MIN(ID) in the inner select and it will work i think?

    haha yes 😀

    Thanks it worked, much appreciated

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Union overwrite null values

    How about alternative ways like this?

    SELECT '9/8/2013', 12345,

    (SELECT [AM_attendance code] WHERE student_id = '12345' and [AM_attendance code] is not null),

    (SELECT [PM_AttendanceCode] WHERE student_id = '12345' and [PM_AttendanceCode] is...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Group by without soring

    Thank you for reply.

    My table have key, problem is if I sort my table with key I have to use it in "GROUP BY" and it generate incorrect output.

    See this:

    CREATE...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: dont want to Row_Number() in second union start from 1

    Thank you everyone for giving me clue.

    I solved this question with this statement:

    WITH

    cte1(col) as (

    SELECT col FROM #table1

    ...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: dont want to Row_Number() in second union start from 1

    Thank you very much for reply.

    Im sorry I just didnt want to waste your precious time to solve my exact problem, but It seems I have to provide more informations.

    I...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: Select several subqueries with more than 1 value

    Thank you every one.

    And sorry for errors in insert statement.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • RE: error:Setuser failed because of one of the following reasons: the database principal 'schemaUser' does not exist,

    Im not sure if my theory is correct, but according to error you gave to us if 'schemaUser' database exists its good to try this:

    1. Login to "sql server management...

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

Viewing 15 posts - 16 through 30 (of 48 total)