Viewing 15 posts - 1,891 through 1,905 (of 7,613 total)
If there are existing overlapping object names, I'd resolve them -- i.e. rename one of the objects -- as part of the rework. So that, even if stored in separate...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 16, 2021 at 3:14 pm
1 Be sure to specify the schema name on the table, assuming of course that it doesn't change from user to user.
FROM dbo.MYTABLE
2. Make the variable the exact same type...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 16, 2021 at 3:04 pm
Here's the revised code. It should work exactly as written now.
DECLARE @sql nvarchar(max)
IF OBJECT_ID('tempdb.dbo.#restore_filelistonly') IS NOT NULL
DROP TABLE #restore_filelistonly;
CREATE TABLE #restore_filelistonly (
...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 15, 2021 at 3:21 pm
Something along the lines below, adjust it as needed to match your environment. You didn't say anything about changing path names for the files, so I just used the paths...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 14, 2021 at 9:34 pm
...hope you can work it out.
You really need to provide truly representative sample data if you want a full solution.
With the sample data thing, with this one it's...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 12, 2021 at 4:35 pm
It seems like you might have a (very) old transaction running.
See what this tells you:
USE tempdb;
DBCC OPENTRAN;
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 11, 2021 at 6:39 pm
...hope you can work it out.
You really need to provide truly representative sample data if you want a full solution.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 11, 2021 at 4:06 pm
I once was getting horribly flawed data from FedEx (missing closing quotes, missing delimiters, etc.; genuinely not expected, given their rep). They would NEVER fix the data. We had to...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 10, 2021 at 8:27 pm
I think this is right. Naturally you'll need to confirm for yourself, as I don't have any additional test data.
IF OBJECT_ID('tempdb.dbo.#data') IS NOT NULL
...SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 10, 2021 at 8:24 pm
Could do this with recursion, from right to left, but for now I'll just do a simple cursor loop. Hopefully that will perform well enough for what you need. Naturally...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 10, 2021 at 6:24 pm
Or just make sure they send a string that is valid for conversion in the language they are using!
If I write '25 dek 2020' in English, then that's my error,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 9, 2021 at 11:07 pm
You will NOT get dup rows from dup values in an IN clause. Easy enough to verify:
CREATE TABLE #t1 ( col1 int NOT NULL )
INSERT...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 9, 2021 at 9:51 pm
Either you to do it by CASTing/CONVERTing one language at a time, or have them include a language code in the file.
You could, though, use CASE so that you could...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 9, 2021 at 9:46 pm
You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 9, 2021 at 9:20 pm
You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect that conversion.
You...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
February 9, 2021 at 8:52 pm
Viewing 15 posts - 1,891 through 1,905 (of 7,613 total)