Viewing 15 posts - 1,111 through 1,125 (of 1,491 total)
The UNIONS are test data! (Read the comments.)
Just use the query and replace the test tables with your tables.
January 9, 2008 at 6:33 am
-- *** Test Data ***
DECLARE @t1 TABLE
(
    Initials varchar(10) NOT NULL
    ,EffectiveDate datetime NOT NULL
    ,RatePerHour money NOT NULL
)
INSERT INTO @t1
SELECT 'aaaa', '20050101', 150 UNION ALL
SELECT 'aaaa', '20050705', 200 UNION ALL
SELECT 'aaaa', '20050901',...
January 9, 2008 at 5:23 am
Without the rest of your tables (P as in P.Tran_ID?) and the rest of the WHERE clause, your post does not make sense.
December 11, 2007 at 7:35 am
Try:
INSERT INTO table_geography
SELECT @geolevel
WHERE NOT EXISTS
(
    SELECT *
    FROM table_geography G WITH (UPDLOCK )
    WHERE G.geolevel = @geolevel
)
December 11, 2007 at 7:01 am
I have a note that the following should work in 2005. (I must have seen it on a forum somewhere.) I have never tried it as ADO/ADO.Net seems less hassle.
CREATE...
December 6, 2007 at 7:49 am
Gail is right to say that order is meaningless in a SQL table, however order does have meaning in your Excel worksheet. In order to retain this order in SQL...
December 4, 2007 at 5:39 am
JReed,
I find all the unneeded brackets in code makes it difficult to read. I have reformatted it as follows:
SELECT DISTINCT
    Accounts.UID
    ,Accounts.Fname + ' ' + Accounts.MI AS Fname
    ,Accounts.Lname...
November 30, 2007 at 8:11 am
Your queries are running correctly, NOT IN and NOT EXISTS are not the same when there are NULLs involved and ANSI_NULLs are on. (Your data must have NULLs in the...
November 29, 2007 at 8:51 am
Try casting to bigint and using the fnNumber2AnyBase function at the following link.
November 28, 2007 at 5:26 am
Conceptually in SQL the FROM clause is evaluated first and then the results are filtered by the WHERE clause.
Think about what you are doing! Will NULL = 46 ever be...
November 21, 2007 at 6:38 am
As the kl filters are after the join in the where clause, I suspect the following:
SELECT ma_idx, ma_kurztext_deu, kd.kd_preis, kl.kd_preis
FROM debitor D
    JOIN kondition kd
        ON D.db_ko_vkpreis = kd.kd_pl_idx
            AND D.db_vkorg = kd.kd_vkorg
    JOIN...
November 8, 2007 at 4:39 am
You will never get an exact way to sort out the duplicates but I would approach it as follows:
1. Write a Longest Common Substring function. (Google for algorithm outlines) This...
November 7, 2007 at 8:45 am
Without some sample data it is difficult to tell what you want.
Maybe something like:
SELECT U1.UserNew
    ,D.TelNumber
    ,D.ChangeDate AS DeviceDate
    ,D.IMEInew
FROM DeviceHistory D
    JOIN (
            UserHistory U1
            LEFT JOIN UserHistory U2
                ON U1.TelNumber = U2.TelNumber
                    AND U1.UserNew = U2.UserOld
                    AND...
October 4, 2007 at 5:33 am
You could try something horrible like:
DECLARE @TimeFrom datetime
,@TimeTo datetime;
SELECT @TimeFrom = DATEADD(mi, -1, MAX([TimeStamp]))
,@TimeTo = MAX([TimeStamp])
FROM dbo.DemandSpread;
SELECT
D1.MinER2BidPrice
,D2.MinER2DSTotal
,D1.MaxER2BidPrice
,D3.MaxER2DSTotal
,D1.MinESBidPrice
,D4.MinESDSTotal
,D1.MaxESBidPrice
,D5.MaxESDSTotal
FROM (
SELECT MIN(S1.ER2BidPrice) AS MinER2BidPrice
,MAX(S1.ER2BidPrice) AS MaxER2BidPrice
,MIN(S1.ESBidPrice) AS MinESBidPrice
,MAX(S1.ESBidPrice) AS MaxESBidPrice
FROM dbo.DemandSpread S1
WHERE S1.[TimeStamp]...
September 17, 2007 at 10:07 am
or you could try something like:
SELECT *
FROM YourTable T
JOIN (
SELECT '98101' UNION ALL
SELECT '98104' UNION ALL
SELECT '98154'
) D (ZIP)
ON T.ZIP LIKE D.ZIP + '%'
September 13, 2007 at 10:21 am
Viewing 15 posts - 1,111 through 1,125 (of 1,491 total)