Viewing 15 posts - 2,296 through 2,310 (of 13,850 total)
Can you please provide sample DDL and INSERT scripts to create your sample data?
Can you also describe exactly how the dataset should be ordered?
November 10, 2020 at 7:41 pm
Once you have some ordering in place, one solution is as follows:
DROP TABLE IF EXISTS #SomeTab;
CREATE TABLE #SomeTab
(
rn INT NOT NULL
...
November 10, 2020 at 2:37 pm
This is not possible as it stands, because the NULL rows do not have any ordering.
What I mean is, there is nothing to associate the first two NULL rows with...
November 10, 2020 at 2:17 pm
The fact that the load to text file is quick suggests (to me, at least) that one or both of
is...
November 4, 2020 at 9:26 pm
Try something like this (I wasn't sure of the names of your source and target tables, so I'll leave that to you):
DECLARE @MaxInsertDate DATETIME
...
November 4, 2020 at 7:01 pm
Could you
SELECT MAX(Last_Updated)
from your target table and use that instead?
November 4, 2020 at 5:28 pm
dface_21 wrote:Currently, I don't have the value stored anywhere.
How do you know when the job last ran?
+1, if you don't know when it last ran, this is close to...
November 4, 2020 at 5:26 pm
I do not. What would be the best way to go about that as a variable?
When the job runs, does it write to a log table? (Containing, for example,...
November 4, 2020 at 4:42 pm
You need to set the value of the @LastJobRun parameter before executing that query.
Do you have this stored somewhere?
November 4, 2020 at 4:23 pm
You could automate the backup/restore process with a bit of scripting.
If you have enough space on your 'data query' server to host two versions of the database, you could do...
November 3, 2020 at 9:09 pm
You could create a calculated, persisted column in your table definition and SELECT that instead.
November 3, 2020 at 8:57 pm
that worked.thanks
And mine didn't? For the sample data you provided, I think it did; it's fast too.
If, as Scott no doubt correctly surmised, your actual data contains variations on...
November 3, 2020 at 7:48 pm
Really? >8,000 points and you still cross-post!
Answers here, please.
November 3, 2020 at 4:16 pm
DROP TABLE IF EXISTS #Path;
CREATE TABLE #Path
(
FilePath VARCHAR(200) NOT NULL
);
INSERT #Path
(
FilePath
)
VALUES
('A:\AABCD\EDFG\RFG\MyDB123.bak')
,('A:\RFG\MyDB1123.bak')
,('A:\AABCD\EDFG\MyDB1223.bak');
SELECT p.FilePath
,LEFT(p.FilePath, CHARINDEX('MyDB',...
November 3, 2020 at 4:13 pm
November 2, 2020 at 3:58 pm
Viewing 15 posts - 2,296 through 2,310 (of 13,850 total)