Forum Replies Created

Viewing 15 posts - 811 through 825 (of 1,131 total)

  • RE: Join from temp table

    In the future. please provide DDL and sample data as per http://www.aspfaq.com/etiquette.asp?id=5006

    Renaming the temporary table to a alias that does not begin with the @ symbol seems to solve...

    SQL = Scarcely Qualifies as a Language

  • RE: Is This Possible in Sql?

    Is there some reason for making the solution to such a simple problem so complicated ?

    You can use the CASE statement or a two line UDF.

    alter FUNCTION dbo.udf_IsShiftValid

    (@StartTime datetime

    , @EndTime...

    SQL = Scarcely Qualifies as a Language

  • RE: Process Blocking Itself

    The "self-blocking" condition will also appear after installing SQL Server Service Pack 4.

    See "The blocked column in the sysprocesses table is populated for latch waits after you install SQL Server...

    SQL = Scarcely Qualifies as a Language

  • RE: Conditional Update Quandary

    Hey Jeff:

    I think we have all had to deal with Clients who have decided to impose an architecture where not all ramifications have been considered.

    When you present a solution...

    SQL = Scarcely Qualifies as a Language

  • RE: calculate field

    Is there some reason that you are using non-standard SQL such as ISNULL instead of COALESCE and CONVERT instead of CAST ?

    The SQL originally posted will run unchanged under DB2,...

    SQL = Scarcely Qualifies as a Language

  • RE: Conditional Update Quandary

    Below is a really stupid solution but it does work under your restrictions.

    Use your existing Dynamic SQL solution to generate a stored procedure for every possible combination of the bitmask....

    SQL = Scarcely Qualifies as a Language

  • RE: calculate field

    Please provide DDL and sample data. See http://www.aspfaq.com/etiquette.asp?id=5006 for instructions.

    Here is an untested solution:

    select MyTable.Product_Number

    , MyTable.Qty_low

    , COALESCE( MIN (H.Qty_low) - 1 , 999999999) from MyTable

    Left outer join

    MyTable as H

    on H.Product_Number...

    SQL = Scarcely Qualifies as a Language

  • RE: Is it the first, second,third, fourth or fifth Saturday of

    Good catch of the bad algorithm and the elegant solution.

    SQL = Scarcely Qualifies as a Language

  • RE: Anyway to make this de-duping process run faster?

    In the future, please post create table and insert statements.

    How about this SQL (an index on Users.email is recommended)

    select email, product_id, product_status

    , MIN (username)

    Into GoodUsers

    FROM ( SELECT email, product_id

    ,...

    SQL = Scarcely Qualifies as a Language

  • RE: Need SQL to Display COUNTs by Month

    select Year(DateSubmitted) as SubmittedYear

    , DATENAME ( mm , DateSubmitted ) as SubmittedMonth

    , count(*) as ApplCount

    from Applications

    where DateSubmitted between @MonthStartDate and @MonthEndDate

    group by Year(DateSubmitted)

    , Month(DateSubmitted)

    , DATENAME (...

    SQL = Scarcely Qualifies as a Language

  • RE: Is it the first, second,third, fourth or fifth Saturday of

    The calculation is relatively simple:

    Take the day of the month for the date and divide by seven (as this is integer calculations, truncation will occur) to get the number of...

    SQL = Scarcely Qualifies as a Language

  • RE: Sum for each category...

    Try:

    select country.country AS [Country],

    orders.ref_number AS [Ref #],

    orders.open_date AS [Date],

    orders.Description AS [Description]

    , COUNT(*) -- NEW

    FROM orders

    left join users orders.userid = users.id

    left join country users.countryid = country.id

    -- NEW START

    GROUP BY country.country...

    SQL = Scarcely Qualifies as a Language

  • RE: set-based way to apply a rounding adjustment to the largest share

    Regarding, "You missed the case when 2 or more shareholders are the largest", should not this section of the SQL handle that case?

    select ContractParty.ContractId

    , MIN(PartyId) AS PartyId

    from ContractParty

    join (select ContractParty.ContractId

    ,...

    SQL = Scarcely Qualifies as a Language

  • RE: set-based way to apply a rounding adjustment to the largest share

    Here is a set-based method based to assign the rounding amount to the party with the largest share and if two parties have equal shares, then the one with the...

    SQL = Scarcely Qualifies as a Language

  • RE: Obtaining Instance Name

    If this is a one-time and manual process, open a command window and enter

    isql -L

    If this is on-going in a program, you can use SQL DMO:

    Dim namX As NameList

    Set...

    SQL = Scarcely Qualifies as a Language

Viewing 15 posts - 811 through 825 (of 1,131 total)