Viewing 15 posts - 1,276 through 1,290 (of 1,418 total)
Assuming the PK is (Site, Item), try something like the following:
-- Insert
INSERT INTO preferred_supplier
SELECT SITE, ITEM, PREF_SUPPLIER, [DESCRIPTION]
FROM pref_temp T
WHERE NOT EXISTS (
SELECT *
FROM preferred_supplier S
WHERE S.Site = T.Site AND...
November 16, 2006 at 5:55 am
You need to use CONVERT instead of CAST.
The style will be 101 for US dates or 103 for UK dates.
Ideally you should alter the table so that dates are stored...
November 16, 2006 at 5:19 am
-- Simple; assuming no time component in date and consecutive days
DECLARE @t TABLE
(
tDate datetime NOT NULL
,Client int NOT NULL
,A int NOT NULL
)
INSERT INTO @t
SELECT '20061101', 1, 100 UNION ALL
SELECT '20061102',...
November 16, 2006 at 4:37 am
I am glad my efforts sort of worked!
You are correct, those horrible multi-valued columns need to be dealt with. The following link may give you some...
November 16, 2006 at 3:56 am
Asim,
>>can you tell me how should i take care about this logic below in my stored procedure
As you have failed to give a cogent description of what you are trying...
November 15, 2006 at 12:05 pm
Asim
Microsoft SQL Server is a relational database so rows in a table should have NO order. (Basic theory.) There often is some order but this cannot be guaranteed!
The...
November 15, 2006 at 11:37 am
If the accuracy of a FLOAT is alright, then just force a FLOAT by adding a decimal point to one of the numbers.
eg. set @Size...
November 15, 2006 at 11:09 am
Carl,
I see no need for dynamic SQL here as the only thing you are adding to the string is @Crit_Label.
To speed this procedure up I suggest you:
1. Convert to static...
November 15, 2006 at 10:54 am
If possible, normalize the schema although a reporting tool should be able to cope with the current table structure.
To get the output requested, something like the following should work:
SELECT
T.Item_ID
,T.Year_ID
,N.Nbr AS...
November 13, 2006 at 10:59 am
Farrell,
I think the difference is that your quick age calculation just uses the difference in years. As all your BirthDates are in December you should really minus one from the...
November 13, 2006 at 9:55 am
You need to group by the formula for TableValue:
INSERT INTO ClaimCounts (Month_of_file, CalcAction, TableValue, CalculatedValue)
SELECT
@Month_of_file_filter AS Month_of_file
,'Record Count by Loss Month' AS CalcAction
,CONVERT(varchar(4), LossDate, 120) AS TableValue -- change...
November 13, 2006 at 9:11 am
You cannot assign a value to a function. Try something like:
UPDATE CUSTOMERS
SET [DATE] = DATEADD(year, 100, [DATE])
WHERE YEAR([DATE]) BETWEEN 1900 AND 1999
November 13, 2006 at 8:08 am
There are probably better ways, but something like this should work in both SQL2000 and SQL2005:
SELECT CASE
WHEN D.Age BETWEEN 20 AND 29 THEN '20-29'
WHEN D.Age BETWEEN 30 AND 39 THEN...
November 13, 2006 at 7:35 am
You can do it via a derived table:
SELECT
D.UM
,D.UM_DIV
,D.UM_DIV * D.QTYORD AS UnitNum
FROM (
SELECT S.UM
,S.QTYORD
,CASE S.um
WHEN 'ea' THEN 1
WHEN 'bx' THEN 10
ELSE 2 END AS UM_DIV
FROM Sales S ) D
November 10, 2006 at 10:16 am
You could try checking to see if any of the VIEWs point to a different server.
Also, as you do not seem to be using any aggregate functions, you could remove...
November 10, 2006 at 9:22 am
Viewing 15 posts - 1,276 through 1,290 (of 1,418 total)