Viewing 15 posts - 1,366 through 1,380 (of 2,645 total)
But it's easy enough to clean up. Just REPLACE(REPLACE(@sql, '1=1 AND ', ''), 'WHERE 1=1', '')
. So if there are additional conditions, you remove the 1 = 1...
October 7, 2019 at 2:49 pm
You can run perfmon and get it to log chosen stats to a flat file or even a SQL Server database. But unless you have something in place and...
October 7, 2019 at 1:02 pm
Declare @startdatetime datetime = '2019-09-01T07:00:00'
Declare @enddatetime datetime = '2019-10-01T07:00:00'
;with cte as
(
Select d.UserId,
...
October 5, 2019 at 6:54 pm
Declare @startdatetime datetime = '2019-09-01T07:00:00'
Declare @enddatetime datetime = '2019-10-01T07:00:00'
;with cte as
(
Select d.UserId,
d.StatusValue,
...
October 5, 2019 at 6:49 pm
select d1.UserId,
d1.StatusValue,
d1.UpdateDate,
d2.StatusValue PrevValue,
...
October 5, 2019 at 3:26 pm
Hi all,
Assuming that I have the phrase "All I want (for Christmas) is better (TSQL) coding skills (this year)."
And I want to remove the parenthesis and everything in between...
October 4, 2019 at 11:53 am
Without wanting to give away the answer, the script creates an empty table variable that it populates to generate a select. So I would look at rewriting the entire script...
October 3, 2019 at 3:13 pm
Hey Jeff. Great idea! I'm going to add this to my notes.
When you have a new historical period, you create a new table and modify the view definition?
At...
October 3, 2019 at 12:50 pm
why the recommendation to do Jonathon's method? This seems just intuitively a little ... weirder or unnatural. What is the nutshell thinking behind this?
If you drop an object then...
October 2, 2019 at 6:20 pm
Test if the object exists first, if it doesn't CREATE the object with minimal functionality, then ALTER the object to have the full code you required.
use ...
October 2, 2019 at 4:29 pm
If you load them into a staging table with the date stored as varchar, you can go through the date column looking at the maximum value of substring(date,1,2) and substring(date,4,2). Hopefully,...
October 2, 2019 at 2:13 pm
The DDL and some sample data of the type of duplicates you want to move would be helpful.
October 2, 2019 at 2:04 pm
I've found performance to be the biggest problem with a MERGE. If you can replace a merge with an update followed by an insert it will give about 60% better...
October 1, 2019 at 4:16 pm
I hadn't read the information about the source table being on another database. A good way to go is to first copy the data onto a Staging table...
September 30, 2019 at 9:41 am
;WITH Data AS
(
SELECT * FROM (VALUES
(1, 1, 'Begin', CONVERT(datetime2,'9/29/2019 9:00:05.656 AM')),
...
September 29, 2019 at 1:59 pm
Viewing 15 posts - 1,366 through 1,380 (of 2,645 total)