Viewing 15 posts - 976 through 990 (of 1,424 total)
What Frederico wrote at the ende: "note that if this query is called multiple times for location then it should be changed so that all locations are supplied (alongside their...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 16, 2020 at 1:46 pm
Phil's solution works well. It's more flexible in that there could be more than 1 character to prefix the []'s
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 9:14 pm
Ok here's a tvf which maybe makes it more maintainable and readable. Fwiw I don't follow Brian's approach and keeping data manipulation logic in the database seems OK imo. To...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 8:36 pm
drop table if exists dbo.test_TID;
go
create table dbo.test_TID(
TIDPrefix varchar(20) not null);
insert dbo.test_TID(TIDPrefix) values
('A[123xyz]'),
('x[UY345]'),
('XP');
drop function if exists dbo.fnTally;
go
CREATE FUNCTION [dbo].[fnTally]
/**********************************************************************************************************************
...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 7:57 pm
Cl 110 is equivalent to SQL Server 2012 iirc
This link has the implementation which (according to Jeff's notes in the function) should work for SQL Server 2008 and above
https://www.sqlservercentral.com/scripts/create-a-tally-function-fntally
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 6:36 pm
String Split won't work here as you have no delimiter on your strings.
Something to add to the TALLY solutions proposed above is that they miss the cases where there...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 6:19 pm
Yet another handy use of a tally table.
drop table if exists dbo.test_TID;
go
create table dbo.test_TID(
TIDPrefix varchar(20) not null);
insert dbo.test_TID(TIDPrefix) values
('A[123xyz]'),
('x[UY345]');
select
...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 15, 2020 at 5:34 pm
I've decided to add my name to the list of Steve's around here. My first post on SSC was about 1 year ago. When I signed up I...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 5:01 pm
I've decided to add my name to the list of Steve's around here. My first post on SSC was about 1 year ago. When I signed up I wasn't sure...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 3:35 pm
Oops wrong thread
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 3:31 pm
It could be 2 procs: 1 with mandatory parameter, and 1 without.
No... you recommended using 2 queries. Not two procedures. If you go further up, you'll see that...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 12:54 pm
Always good to hear differing methods. Optional parameters are the bane of my life, but that's a reasonable well established method of dealing with it, and fairly low cost...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 12:36 pm
Thanks all for your responses,
My question now is Why? Why does not works as is ? we are suggested to a very strict change control policy
Thanks
Why questions are tricky! Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 12:28 pm
Also not a good idea... Give this a read: https://www.red-gate.com/simple-talk/sql/t-sql-programming/how-to-confuse-the-sql-server-query-optimizer/
Ha, my recommendation is 2 procs so there's nothing to confuse. If the OP wants to keep dealing with avoidable...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 11:41 am
Yup, of course NULL does not equal NULL, but the fldinfo cannot be NULL (confirmed by OP).
So presumably @Parameter is optional and can be NULL. In which case the...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
July 14, 2020 at 11:15 am
Viewing 15 posts - 976 through 990 (of 1,424 total)