Viewing 15 posts - 3,826 through 3,840 (of 10,144 total)
Here's an alternative to Abu Dinas' suggestion;
SELECT
b.dbPatID,
b.dbPatFirstName,
b.dbPatLastName,
x.dbStaffLastName,
b.TotTot
FROM EPSAgedBalances b
CROSS APPLY (
SELECT TOP 1 dbStaffLastName
FROM EPSAllContracts c
WHERE c.dbPatID = b.dbPatID
) x
WHERE b.TotTot < 0
Not...
January 2, 2014 at 2:30 am
SELECT CounterDateTime = CAST(CAST(CounterDateTime AS CHAR(24)) AS DATETIME)
FROM (SELECT CounterDateTime = '2013-12-30 12:09:00.123' + CHAR(10)) d
-- Msg 241, Level 16, State 1, Line 1
-- Conversion failed when converting date and/or...
December 31, 2013 at 5:23 am
Try this - it's called a CROSSTAB query:
SELECT id,
LevelDesc1 = MAX(CASE WHEN levelid = 1 THEN leveldesc ELSE NULL END),
LevelDesc2 = MAX(CASE WHEN levelid = 2 THEN leveldesc ELSE NULL...
December 31, 2013 at 5:11 am
The return value of a stored procedure is traditionally used for this:
RETURN 0 if the procedure ran successfully
RETURN -n if the procedure failed.
ALTER PROCEDURE TestOutput @Outcome CHAR (4)
AS IF...
December 31, 2013 at 5:05 am
BlackIceAngel (12/31/2013)
That is perfect thank youThe solution needs the SUM() function though for my requirements,
SELECT SUM(ABS(k.Amount + k.VATAmount)) AS TOTAL.
Love this site!
So long as you are aware that SUM()...
December 31, 2013 at 4:48 am
dwain.c (12/31/2013)
ChrisM@Work (12/31/2013)
Stefan Krzywicki (12/30/2013)
wolfkillj (12/30/2013)
Stefan Krzywicki (12/30/2013)
wolfkillj (12/30/2013)
GilaMonster (12/30/2013)
wolfkillj (12/30/2013)
December 31, 2013 at 4:39 am
You're welcome, thanks for posting the final query. If it works for you and generates the results you want, then that's good and you're probably done - but I'd recommend...
December 31, 2013 at 4:13 am
Can you post your solution please? It's closure for your thread, offers closure for those who have helped you, and may help others who stumble upon this thread whilst seeking...
December 31, 2013 at 3:37 am
raghuldrag (12/31/2013)
i need the output likefor example 2013-04-01 is in table my expectation output is 04-2013 (extract month with year)......
Is '2013-04-01' a date datatype or a string datatype?
You are...
December 31, 2013 at 3:35 am
The good ol' ROW_NUMBER() trick might be worth a try. A few tests on a similar-sized table here indicates relative costs of 20% for the table scan, 30% for the...
December 31, 2013 at 3:29 am
Split thread. Please post replies to the original thread here, where you will obtain background information and progress to date.
December 31, 2013 at 2:56 am
Split thread. Please post replies to the original thread here, where you will obtain background information and progress to date.
December 31, 2013 at 2:55 am
Here's the very first query from your very first post, reformatted and with table aliases applied for readability:
SELECT
SUM(Amount=ABS((
SELECT Top 1 Amount + VATAmount
FROM FAAccKitty k1 WITH(NOLOCK)
Where k1.PlaceID...
December 31, 2013 at 2:52 am
eobiki10 (12/30/2013)
Thanks Chris for responding to this query. I have been able to solve the problem.EO
Can you post your solution please? It provides closure for this thread and for those...
December 31, 2013 at 1:55 am
Stefan Krzywicki (12/30/2013)
wolfkillj (12/30/2013)
Stefan Krzywicki (12/30/2013)
wolfkillj (12/30/2013)
GilaMonster (12/30/2013)
wolfkillj (12/30/2013)
December 31, 2013 at 1:53 am
Viewing 15 posts - 3,826 through 3,840 (of 10,144 total)