Viewing 15 posts - 3,631 through 3,645 (of 3,957 total)
Jeff Moden (5/9/2012)
WITH F(x) AS (SELECT TOP (CHECKSUM(66-ASCII('A'))) '/'+CONVERT(CHAR(8),GETDATE(),CAST(EXP(0) AS INT)) FROM sys.objects)
SELECT STUFF(REPLACE(LEFT(x,POWER(73,1/2)*POWER(25,1/2.0)),'/0','/')
...
May 9, 2012 at 11:33 pm
I have a rather strange alternative for you here. I say strange because the query plan looks ridiculously more complicated than either the one produced by Lynn's or by...
May 9, 2012 at 10:52 pm
If you don't want duplicates in ColdCoffee's suggestion:
-- Replace:
SELECT *
-- With:
SELECT DISTINCT Ac_no, Code_list
Or, another alternative with a cheaper execution plan cost would be this (also eliminates duplicates):
SELECT *
FROM @Account...
May 9, 2012 at 9:57 pm
The datetime datatype stores the data differently that the way you think it is being displayed. That's controlled by a SQL Server default setting.
To "store" in US format as...
May 9, 2012 at 7:59 pm
ColdCoffee is right. You shouldn't burden your helpers with having to set up your DDL and sample data for you. Today I was feeling generous.
Can do with PIVOT...
May 9, 2012 at 7:54 pm
I guess if you want to run the query on SQL Server and you are content to return a character string to your MS Access application, you can do something...
May 9, 2012 at 7:28 pm
Three other options are:
SELECT CountofFailure = SUM(CAST(void AS INT))
,CountofSuccess = SUM(CAST(~void AS INT))
FROM test
SELECT CountofFailure = SUM(0 + void)
,CountofSuccess = SUM(1 - void)
FROM test
SELECT CountofFailure =...
May 9, 2012 at 7:17 pm
Actually, I have a better idea. If you need to worry about ClientIDs that have accounts but no purchases (the above query won't work), use this.
;WITH CTE (ClientID, AccountNumber,...
May 9, 2012 at 6:14 am
I would do this with a correlated subquery, thusly:
SELECT ClientID
,(SELECT COUNT(AccountNumber)
FROM #ClientAccounts ca
WHERE ca.ClientID = cp.ClientID
GROUP BY ClientID) AS NumAccounts
,NumPurchases, AmtPurchases
FROM (
SELECT ClientID, COUNT(ClientID) AS NumPurchases,...
May 9, 2012 at 4:35 am
ChrisM@Work (5/8/2012)
SELECT Strings, x.Goodchars, y.Badchars
FROM #t
CROSS APPLY (
SELECT SUBSTRING(Strings,n,1)
FROM (SELECT TOP...
May 9, 2012 at 12:27 am
Is this the result you are looking for:
DECLARE @l TABLE (ID INT, [Name] VARCHAR(30), Location VARCHAR(100))
DECLARE @d CHAR(1)
SET @d = ','-- Delimiter
INSERT INTO @l (ID, [Name], Location)
SELECT 1, 'Ronaldo', 'Country:Spain,...
May 8, 2012 at 7:19 pm
My humblest apologies sir!
Seems I made several mistakes on this thread this day. Clearly the Force was not with me.
Probably should stick to playing with my cats.
May 1, 2012 at 6:59 am
Seemingly I have been challenged here.
Rising to the occasion, I can take Jeff's wonderful articles on generating random data and concoct an approach of my own to generate random gaps....
April 30, 2012 at 11:06 pm
Jeff Moden (4/30/2012)
Samrat Bhatnagar (4/28/2012)
Any suggestions on how to generate test data for following scenarios:
1. Two tables linked using PK-FK relationship e.g. Product...
April 30, 2012 at 10:00 pm
Jeff Moden (4/30/2012)
dwain.c (4/30/2012)
Now this one ties with yours but my second solution comes up lowest.How did you measure?
Actual execution plan costs.
Before you say again that the actual execution plan...
April 30, 2012 at 9:32 pm
Viewing 15 posts - 3,631 through 3,645 (of 3,957 total)