Forum Replies Created

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

  • RE: SSDT

    Alvin, I don't understand that....

    it has a powerful data table compare and auto scripting feature.

    It apparently can take two tables and provide a script to make sure they are equivalent.....at...

  • RE: Control of Flow - where is CASE ?

    Luis Cazares (9/18/2015)


    Because T-SQL doesn't like to have flow control.

    Why exactly ?

    BTW: Thanks for that "THEN" but IMHO that should be optional.

  • RE: Trying to return a table of tablenames dynamically

    Awesome Kristen.....and thanks....

    I'll remember this one for sure.

    Very elegant. I was all bollexed up with how to specify the CASE statement.

    Now I Just execute: SELECT * from dbo.FnReturnTablesForGroup(1)

    And a list...

  • RE: Trying to return a table of tablenames dynamically

    Thanks Sean, but remember, my potential solution would effectively be 2 lines of code.

    One to define the table via string, the other to call a function to convert it to...

  • RE: Trying to return a table of tablenames dynamically

    Fair enough Sean, thanks for that idea.

    However, I don't agree that using comma-delimited lists violates any rules of relation theory.

    A list is a list....whether it's in table form or...

  • RE: Trying to return a table of tablenames dynamically

    This compiled but won't execute:

    Msg 557, Level 16, State 2, Line 1

    Only functions and some extended stored procedures can be executed from within a function.

    ALTER FUNCTION dbo.fnReturnTablesForGroup

    (

    @whichgroup int

    )

    RETURNS @RETTAB TABLE...

  • RE: Trying to return a table of tablenames dynamically

    Thanks Sean, but whe I try to use a temp table, I get:

    "Msg 2772 - Cannot access temporary tables from within a function."

    What I am trying to do is develop...

  • RE: Integer column shows 5.00000000000000000 as value

    My bad....the column was formatted as decimal (who did that ??!!**&&)

  • RE: Create dates right on the hour interval-best technique

    Thanks Luis for the explanation.....it's very slick.

    I like to call these things "patterns" ...as they can be reused to solve similar problems.

  • RE: Create dates right on the hour interval-best technique

    Sorry guys, my bad....definitely having a bad day.

    And DateAdd is probably efficient....as whenever strings are involved, the conversion is usually costly.

    Lowell's solution is very slick and efficient.

    Sean's solution is way...

  • RE: Create dates right on the hour interval-best technique

    Thanks for that...forgot about FORMAT.

    The final solution:

    SELECT Convert(smalldatetime,FORMAT(GETDATE(), 'yyyy-MM-dd hh:00:00'))

    In fact that works with datetime format as well.

    My solution was too convoluted....however, since no string conversion was involved, it...

  • RE: Create dates right on the hour interval-best technique

    Sean Lange (9/4/2015)


    mar.ko (9/4/2015)


    I tried this:

    SELECT Convert(smalldatetime,Round(Convert(float,(dbo.fnDateOnly(getDate())))+16.0000000/24.0000000,6))

    Result: 2015-09-04 16:00:00

    It works (FnDateOnly strips the time).

    Is there a more efficient way ?

    What are you trying to do? And what is fnDateOnly?

    RTFM: (FnDateOnly...

  • RE: Why does this result in 0 ?

    Thanks guys...that was not obvious to me.

  • RE: CONVERT BUG ?

    Here is that function that I had mentioned in a previous post.....ughhh

    CREATE FUNCTION dbo.IsBigInt (@a varchar(30))

    returns bit

    AS

    BEGIN

    -- Submitted to SqlServerCentral by William Talada

    DECLARE

    @s-2 varchar(30),

    @i int,

    @IsNeg bit,

    @valid int

    -- assume...

  • RE: CONVERT BUG ?

    Luis Cazares (9/3/2015)


    Not really strange as it converts to an int within the IIF before being converted to a bigint.

    the problems caused by ISNUMERIC

    No excuse on Microsoft's part....should have been...

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