Viewing 15 posts - 1,651 through 1,665 (of 7,619 total)
I asked because many people are happy with code as long as it ultimately does what they need it to do, i.e. "the code's good enough for me." In that...
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".
April 26, 2021 at 9:42 pm
Btw, why are you using such an inefficient method, checking the column values one by one?
What are you asking why instead of posting a link 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".
April 26, 2021 at 9:34 pm
Hi,
I get the object id, it stopped working when I updated the management studio, i think it is not the code, but rather a new thing...
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".
April 26, 2021 at 9:31 pm
Btw, why are you using such an inefficient method, checking the column values one by one?
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".
April 26, 2021 at 9:22 pm
Please do some research and look up the E you rules for triangulation. This means that you have to convert from currency A to Euros, then from Euros to currency...
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".
April 26, 2021 at 8:46 pm
Is it possible that OPERATION is a view (or synonym) and not a table?
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".
April 26, 2021 at 8:42 pm
Did you run the SELECT by itself to make sure you get results from that?
SELECT c.name
FROM sys.tables t
JOIN sys.columns c ON t.object_id = c.object_id
WHERE t.name...
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".
April 26, 2021 at 8:41 pm
I think this is a form of Gaps and Islands (term coined by Itzik Ben-Gan? maybe?). It's rather traditional in G&I to use the name "grp", so I stuck with...
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".
April 26, 2021 at 8:36 pm
Yes, only 1 OUTPUT clause. My best suggestion is to use CASE for every column. You can generate the CASE statements from the table definition so you don't have 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".
April 26, 2021 at 12:21 pm
Just now noticed the Postgre sql qualification. I answered for SQL Server; code may or may not work on Postgre.
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".
April 26, 2021 at 2:42 am
For (1):
SELECT GUEST.GUESTID
FROM GUEST
WHERE GUEST.GUESTNAME='John %' /*space added because don't want name 'Johnathan' or 'Johnny'*/ AND
EXISTS(SELECT 1 FROM BOOKING WHERE BOOKING.GUESTID=GUEST.GUESTID AND...
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".
April 26, 2021 at 2:41 am
This ends up being a very complex task. There are a number of threads about it on this site.
Here's a doozy (from history): Claus Philipp Maria Justinian Schenk Graf von...
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".
April 22, 2021 at 11:18 pm
An alternative:
SELECT
Field0,
CASE WHEN Field1_with_Field4 <> '' THEN Field1_with_Field4 ELSE Field1_without_Field4 END AS Field1,
CASE WHEN Field1_with_Field4...
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".
April 22, 2021 at 11:14 pm
USE [DB_XYZ];
GRANT EXEC TO [MyDomain\User_1]
That includes system procs, of course. If you prefer, you can do this:
GRANT EXEC ON SCHEMA::dbo TO [MyDomain\User_1]
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".
April 21, 2021 at 2:12 pm
(3) SQL does that itself, so that's only a very minor consideration.
I might be misinterpreting what you're saying above but,...
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".
April 20, 2021 at 2:38 pm
Viewing 15 posts - 1,651 through 1,665 (of 7,619 total)