Forum Replies Created

Viewing 15 posts - 61 through 75 (of 171 total)

  • RE: Select columns dynamically

    Thanks Eugene a nice sugestion!:w00t:

    But I want to know if there any way to trick SP_ExecSQL to pass a object name as a varible do a dynamic SQL as a...

  • RE: Select columns dynamically

    Yes Jeff,

    I dislike to make dynamic SQL like that.

    (SQL Inject prone AND no statistics AND recompilations...)

    Is it possible to use the @tableName and @columnName in a safe way with sp_executeSQL?

    Anyway.

    If...

  • RE: Sql sever 2008 advice

    I'm not a DBA but I was introduced to the SQL world because while working in a tiny company someone (anyone) must take care of the DB.

    So I learned T-SQL,...

  • RE: Column Name Restrictions / Description Keyword

    Create a pattern, if your team mates can read it and understand it easy its a good pattern.

    Returning two homonimal columns in a query is a nuisance, I agree but...

  • RE: Select columns dynamically

    Cadavre (3/6/2012)


    Cool.

    Try this non-cursor one instead and see if you get any joy 😀

    Pretty good! :w00t:

    non-cursor was my initial goal but I give up just because its not possible to...

  • RE: Select columns dynamically

    Eugene Elutin (3/6/2012)


    ...

    Your generic one is cool! Pack it, wrap it and sell it 😀

    I'll no sell it, I just like to code and make it for funny. You can...

  • RE: Select columns dynamically

    Eugene Elutin (3/6/2012)


    I have a gut feeling that this requirement comes from not very well thought out design.

    Me too...

    I cannot see why would you want to do what OP...

  • RE: Select columns dynamically

    Well, I wrote a more generic solution to any user table.

    create table TESTE (PK int, C1 char(1), C2 char(1), C3 char(1), C4 char(1), C5 char(1))

    GO

    insert into TESTE values

    (1, 'a', NULL,...

  • RE: Better option than using Stored procedures

    The only scenario where letting the query in the report is better than writing a SP is when the DB lies in a third party server and you have no...

  • RE: Select columns dynamically

    Are you trying some sort of

    select ISNULL(c1,'')+ISNULL(c2,'')+...

    ?

  • RE: Column Name Restrictions / Description Keyword

    Prefix is good to diff between views and tables.

    Adding the table name to the columns is a bit redundant.

    Except for the FKs (or if you like single char aliases in...

  • RE: Column Name Restrictions / Description Keyword

    If you are afraid of creating a table named CAVEAT and in any point in the future it begins to be a T-SQL reserved word you can prefix your objects...

  • RE: Arithmetic 1

    I'm pretty sure SQL ill not multiply chars '1' * '4' it demands at least one numeric type to decide for the result type.

    Yes! Implicit convertion is evil.

    Even worst when...

  • RE: Not Returning Null Records

    bmovedout IS NULL

    is a better option than:

    ISNULL(bmovedout, 0) <> -1

    if there are a index for the [bmovedout] column.

    Since the second option forces the query to evaluate the ISNULL() function for...

  • RE: Identifying a tablename by interpreting a GUID-Column

    A view can do the trick but for big tables I can choose to add a column to tblWV to flag the source table.

Viewing 15 posts - 61 through 75 (of 171 total)