Viewing 15 posts - 811 through 825 (of 1,131 total)
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
December 3, 2005 at 6:02 am
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
December 2, 2005 at 3:28 pm
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
December 2, 2005 at 9:33 am
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
December 1, 2005 at 3:54 pm
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
November 30, 2005 at 4:13 pm
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
November 30, 2005 at 11:47 am
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
November 29, 2005 at 5:43 pm
Good catch of the bad algorithm and the elegant solution.
SQL = Scarcely Qualifies as a Language
November 29, 2005 at 4:15 pm
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
November 29, 2005 at 3:56 pm
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
November 29, 2005 at 6:57 am
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
November 28, 2005 at 7:02 pm
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
November 28, 2005 at 6:17 pm
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
November 28, 2005 at 5:51 pm
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
November 28, 2005 at 1:13 pm
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
November 26, 2005 at 11:35 am
Viewing 15 posts - 811 through 825 (of 1,131 total)