Viewing 15 posts - 2,296 through 2,310 (of 3,543 total)
Bit long winded but might work
CREATE TABLE #temp (rowid int IDENTITY(1,1), colid int,
CustomerCode, AddressId, CustomerCode, a.AddressType, a.DateReceived, Line1, Line2, Line3, Line4, ZipCode)
INSERT INTO #temp
(colid, CustomerCode, AddressId, CustomerCode, a.AddressType, a.DateReceived,...
June 17, 2005 at 7:29 am
This because the engine used to read the spreadsheet tries to decide whether each column is char or numeric based on it's data (IIRC the first 7 rows). If any...
June 9, 2005 at 7:38 am
Maybe something like this
DROP PROCEDURE usp_test
GO
CREATE PROCEDURE usp_test
@a int = NULL,
@b int = NULL,
@c char(5) = NULL
AS
SELECT a,b,c
FROM tbl1
WHERE a = ISNULL(@a,a)
AND...
June 6, 2005 at 6:42 am
My query will return two rows per customer!!
We need more info if the query does not produce what you want
May 31, 2005 at 6:03 am
![]() | As I've said, use a calendar table. |
Maybe, maybe not, a lot of trouble for small return
May 11, 2005 at 8:03 am
or like this (will only work for one year!)
SELECT Customer, [Type],
SUM(CASE WHEN [Month] = 1 THEN [Value] ELSE 0 END) as [Jan],
SUM(CASE WHEN [Month] = 2 ...
May 11, 2005 at 7:57 am
SET DATEFIRST 7
SELECT ((DATEDIFF(week,[startdate],[enddate]) -
(CASE WHEN DATEPART(weekday,[startdate]) IN (1,7)
OR DATEPART(weekday,[enddate]) IN (1,7) THEN 1 ELSE 0 END)) * 2) +
(CASE WHEN DATEPART(weekday,[startdate]) =...
May 11, 2005 at 7:39 am
![]() | The problem is I cannot use @@Fetch_Status... |
You can but as stated in BOL you have to be...
May 11, 2005 at 7:08 am
Is this what you are trying to do?
CREATE TRIGGER TRG_STOCKS ON [dbo].[T_STOCKS]
FOR INSERT, UPDATE
AS
BEGIN
UPDATE t
SET [DESCRIPTION] = (CASE WHEN d.ITEM_NO IS NULL THEN 'NEW RECORD...
May 11, 2005 at 7:01 am
or this might even work
DECLARE @AUDITTIMESTAMP bigint
SET @AUDITTIMESTAMP = SELECT CAST(DATEDIFF(day,'01/01/1970',DATEADD(day,-30,GETDATE())) as numeric) * 24 * 60 * 60 * 1000
SELECT *
FROM [Table]
WHERE AUDITTIMESTAMP < @AUDITTIMESTAMP...
May 10, 2005 at 7:39 am
If DATEADD(hh, - 05, DATEADD(ss, AUDITTIMESTAMP / 1000, '01/01/1970')
returns the correct date (seems like this data is from a legacy system!)
then you could do the following
WHERE DATEDIFF(day,DATEADD(hh, - 05, DATEADD(ss,...
May 10, 2005 at 7:22 am
I have lots of dts packages like this, I use an 'Execute SQL Task' to do a select on the source table (using a single key) and only execute the...
April 29, 2005 at 7:25 am
![]() | I guess what I'm really asking is when should I check for object_id() is null |
object_id will return...
April 29, 2005 at 7:03 am
nice
slight change to reduce data for aggregates
select distinct e1.emp_id
from #emp e1
INNER JOIN #emp e2
on e1.emp_id = e2.emp_id
and e2.met = 1...
April 26, 2005 at 8:56 am
or
delete ol
from tblorderline ol
inner join tblOrders o
on o.OrderID = ol.OrderID
and o.Offercode = 'NWZ'
April 26, 2005 at 6:58 am
Viewing 15 posts - 2,296 through 2,310 (of 3,543 total)