Forum Replies Created

Viewing 15 posts - 8,611 through 8,625 (of 8,731 total)

  • RE: "UPDATE" Is Not Updating Correctly

    You need to use subqueries.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted answers getting worse?

    I've seen that too, but also, I've seen that what seems a simple sintax problem is just the tip of the iceberg and the real problem needs sample data and...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Equivalent to "#INCLUDE" Preprocessor Directive in T-SQL?

    I might be thinking outloud and it could be even more work, but is an idea.

    Could you use a stored procedure that will assign all those values to output parameters?...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Stored Procedure Wont Create - Invalid column name

    Why would you want to add a column in a stored procedure?

    That won't be reusable.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subquery

    joshphillips7145 (8/9/2012)


    *upDate* I got rid of the error message but it does not return any data??

    Select course1.Ref_Number, course1.enrollment

    From course As course1 JOIN Course As course2

    ON course1.Ref_Number = course2.Ref_Number

    Group by course1.Ref_Number,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subquery

    You cannot accomplish that using a self join as you did.

    The only way I figure it out, would be with a derived table.

    SELECT course1.Ref_Number, course1.enrollment

    FROM Course As course1

    JOIN (SELECT...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subquery

    Do you mean to use the subquery as a derived table?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Multiple Aliases for a single Column

    I don't understand the problem, but I believe you don't need multiple aliases.

    Can you explain in more detail and give the exact problem? Or what do you mean by this:

    Problem...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subquery

    No, you're still putting the subquery in the field list.

    Put it in the WHERE clause where you can compare the result of the subquery to your field and filter...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subquery

    The subquery should be on the WHERE clause.

    Remember you're trying to compare a value against the average to filter information.

    Do you need more tips? Can you change your query?

    EDIT: You...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Constraint Event Order

    Now, this is very weird behavior.

    Correct answers: 98% (414)

    Incorrect answers: 2% (10)

    Total attempts: 424

    --------------------------------------------------------------------------------

    1.INSTEAD OF triggers, AFTER triggers, constraints 6%

    --------------------------------------------------------------------------------

    2.INSTEAD OF triggers, constraints, BEFORE...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL concatenate - please help

    Another option, could be

    SELECT ISNULL(NULLIF(fm_clinum, '') + CHAR(10), '') +

    ISNULL(NULLIF(fm_contac, '') + CHAR(10), '')

    ...

    FROM...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL concatenate - please help

    That was my first thought Sean, but he wanted to identify the empty strings to avoid additional lines.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Trigger to rollback if no PK assigned

    Maybe you could use a DDL trigger or Policy-Based Management.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL concatenate - please help

    If you validate your blanks with LEN(field) > 0, you don't need to worry about the nulls.

    SELECT CASE WHEN LEN(fm_clinum) > 0 THEN fm_clinum + CHAR(10) ELSE '' END +

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 8,611 through 8,625 (of 8,731 total)