Viewing 15 posts - 796 through 810 (of 3,957 total)
You could consider doing the DELETE/UPDATE in one fell swoop using a MERGE.
WITH Template AS
(
SELECT TID, LineID, ProductID
,rn=ROW_NUMBER()...
February 11, 2014 at 6:09 pm
Here's another way.
SELECT [Count]=COUNT(*), [State]
,CreatedOn=STUFF(y, 5, 1, 'Q' + q)
FROM dbo.Ticket a
CROSS APPLY
(
SELECT LEFT(DATEPART(year, CreatedOn), 4) + ' '
...
February 11, 2014 at 5:45 pm
marcipesa (2/11/2014)
Many thanks to everybody!I will try to (understand and) apply your suggestions ASAP!
You should probably try to answer Jeff's questions. It is very likely he's got something superior...
February 11, 2014 at 3:13 am
A man of mystery then. Not so easy to climb into your mind as you may think.
February 10, 2014 at 8:15 pm
Jeff Moden (2/10/2014)
February 10, 2014 at 8:07 pm
BTW. If you're going to use this solution, you're going to need to understand the dynamic SQL anyway. So I suggest that you do so by attempting to...
February 10, 2014 at 6:46 pm
To clarify a bit on my "black box" dynamic SQL solution, it builds a query that looks like this (with not the same indentation of course):
SELECT d.A, d.D, d.E
FROM #Table2...
February 10, 2014 at 6:34 pm
This way should be a little faster than what I was originally thinking about.
CREATE TABLE #Table1
(
A INT PRIMARY KEY
,B ...
February 10, 2014 at 6:25 pm
How big is Table B?
I know of one way for sure but if you've got lot's of rows in Table B it will be quite slow.
February 10, 2014 at 5:40 pm
You can use FIRST_VALUE for the first case or MIN for either case.
WITH PreAggregate AS
(
SELECT CustomerID, OrderDate=MIN(OrderDate)
--FROM #SalesOrderHeader
FROM...
February 9, 2014 at 5:49 pm
Sorry but I don't have/use Adventure Works.
February 8, 2014 at 6:53 pm
declare @TableName varchar(50)
set @TableName = 'Hosea_tblDATA_NOTES'
DECLARE @SQL NVARCHAR(MAX) = N'select * from ' + @TableName;
EXEC sp_executeSQL @SQL;
You cannot SELECT from a local string variable as you're trying to do without...
February 7, 2014 at 1:41 am
With DDL for TABLE ApplicationConfiguration, specifically data types for InstanceId and SiteiD, someone might be able to propose a hypothesis.
February 7, 2014 at 1:32 am
Steve Jones - SSC Editor (2/6/2014)
However, this way they can give feedback that something worked. We are talking about how to best get other info from the "crowd" on posts.
So...
February 7, 2014 at 1:27 am
It seems that the harsh critic has been universally condemned for his harsh remarks. You know what they say about movie critics, if you can't act become a critic!...
February 6, 2014 at 9:38 pm
Viewing 15 posts - 796 through 810 (of 3,957 total)