Viewing 15 posts - 2,296 through 2,310 (of 3,544 total)
This assumes a maximum of four values with either hyphen or full stop delimiter and a maximum of 4 chars between delimiters
ORDER BY
ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),4),4),'')+
ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),2),4),'')+
ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),3),4),'')+
ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),1),4),'')
Far away is close at hand in the images of elsewhere.
Anon.
June 23, 2005 at 7:21 am
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,...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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
Far away is close at hand in the images of elsewhere.
Anon.
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
Far away is close at hand in the images of elsewhere.
Anon.
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 ...
Far away is close at hand in the images of elsewhere.
Anon.
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]) =...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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,...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
April 26, 2005 at 8:56 am
Viewing 15 posts - 2,296 through 2,310 (of 3,544 total)