Forum Replies Created

Viewing 15 posts - 1,891 through 1,905 (of 2,171 total)

  • RE: Identity Columns

    I think you can alter the data afterwards, but only if you turn off IDENTITY for the column with ALTER statement.

  • RE: Need help with a loop adding time to a date

    I think this looks quite nice too...

    SELECT      CONVERT(VARCHAR, DATEADD(minute, 30 * (b0.i + b1.i + b2.i + b3.i + b4.i + b5.i), 0), 108) Time

    FROM        (SELECT 0 i UNION ALL...

  • RE: How to evalue the result of store procedure in visual basic?

    Microsoft says you just ad the parameter to the command object, never initialize it, and after excuting the stored procedure, check the value of the parameter.

    The return_value parameter is a...

  • RE: How to evalue the result of store procedure in visual basic?

    For the command object, check out property Direction with value adParamReturnValue

  • RE: How to evalue the result of store procedure in visual basic?

    For the command object, check out property Direction with value adParamReturnValue

  • RE: Problem with a select Msq. 156

    Yes.

    Put a space before the WHERE ...

  • RE: Problem with a select Msq. 156

    What datatype is dteDiaJuro? What datatypes are @periodo_inicio and @periodo_fim?

    Give the whole picture, please. Are you building a dynamic SQL statement?

  • RE: Problem with a select Msq. 156

    What will happen if you replace your code with this instead?

    SELECT  @periodo_temp2 = SUM(nValorJuro4)

    FROM    #TAB2

    WHERE   dteDiaJuro BETWEEN @periodo_inicio AND @periodo_fim

    Also, which datatypes are nValorJuro4 and @period_temp2?

  • RE: Stored procedure for Median

    Suresh, use this function to calculate your MEDIAN.

    CREATE FUNCTION dbo.fnMedian

    (

        @TypeOfRequest VARCHAR(20),

        @Priority INT,

        @InputStyle TINYINT

    )

    RETURNS FLOAT

    AS

    BEGIN

        DECLARE @Items INT,

                @Low INT,

                @High INT

        DECLARE @Values...

  • RE: Stored procedure for Median

    The median of {1,5,1233} is 5. It is the middle value of a set of numbers, not the average value.

    Applicable only if there are odd numbers of values.

    The median of...

  • RE: complex SQL query...to me anyway...

    -- prepare test data

    declare @batches table (batchid int primary key clustered)

    insert @batches

    select 1 union all

    select 3 union all

    select 2

    declare @tests table (testid int primary key clustered)

    insert @tests

    select 1 union...

  • RE: complex SQL query...to me anyway...

    Is it something like this you want?

    -- prepare test data

    declare @batches table (batchid int primary key clustered)

    insert @batches

    select 1 union all

    select 2 union all

    select 3

    declare @tests table (testid...

  • RE: complex SQL query...to me anyway...

    You must use LEFT JOIN here. And possibly a CROSS JOIN, depending on your table designs.

    I can't tell you more until you post the table design here, together with some sample...

  • RE: Can this be done in set based TSQL

    And just a quick note to get the RelationGroup...

    Put

    select (select count(distinct main) from @relations r where r.main <= z.main) relationgroup, related

    from (

    and

    ) z

    order...

  • RE: Splitting Column Values

    DECLARE  @sql VARCHAR(8000),

             @Field VARCHAR(100)

    SELECT   @Field = MyField -- This is where you get the "6,7,8" string...

    FROM     MyTable

    WHERE    SomeID = 31

    SELECT   @sql = 'SELECT * FROM...

Viewing 15 posts - 1,891 through 1,905 (of 2,171 total)