Viewing 9 posts - 16 through 25 (of 25 total)
DECLARE @s varchar(max)='1,2,4,5,7,8,11,12,13,15,17,19,20'
;WITH n AS
(
SELECT 1 x
UNION ALL
SELECT x + 1
FROM n
WHERE x < 20
)
SELECT x
FROM n
WHERE ',' + @s + ',' NOT LIKE '%,' + CAST(x...
May 25, 2026 at 8:14 am
hi hope this helps
drop table if exists #abc
create table #abc ( col1 varchar(100) )
insert into #abc values
(' 1,2,4,5,7,8,11,12,13,15,17,19,20')
select * from #abc
t-sql solution
;WITH x AS
(
SELECT v =...
May 24, 2026 at 3:14 pm
hi hope this helps
SAMPLE DATA
DROP TABLE IF EXISTS dbo.SampleData;
GO
CREATE TABLE dbo.SampleData
(
Col1 VARCHAR(20)
);
GO
INSERT INTO dbo.SampleData (Col1)
VALUES
('A'),
('B'),
('A10'),
('A20'),
('B05'),
('A10Q'),
('A30P'),
('B05X'),
('A10QA'),
('B05XY'),
('A10QA01'),
('A10QA02'),
('B05XY99'),
('C'),
('C03'),
('C03C'),
('C03CA'),
('C03CA01'),
('D07'),
('D07M'),
('E99ZZ01');
GO
T-SQL solution
SELECT
Col1,
CASE WHEN LEN(Col1) >= 1 THEN LEFT(Col1,1) END AS Level1,...
May 23, 2026 at 4:32 pm
hi
hope this helps
DROP TABLE IF EXISTS SampleData;
CREATE TABLE SampleData
(
col1 VARCHAR(max)
);
INSERT INTO SampleData (col1)
select 'NYSTATIN SUSP 500000 UNIT = 5 ML (1 5 ML CUP)'
UNION ALL
Select 'NYSTATIN SUSP 0.75 UNIT =...
May 21, 2026 at 7:34 am
hi
hope this helps
DROP TABLE IF EXISTS SampleData;
CREATE TABLE SampleData
(
col1 NVARCHAR(max)
);
INSERT INTO SampleData (col1)
select 'Sarat'
union ALL
select 'qwerty'
union ALL
select 'AS123werTy'
t-sql solution
select
col1
,case when
col1 COLLATE Latin1_General_CS_AS <> lower(col1 COLLATE Latin1_General_CS_AS) then...
May 21, 2026 at 5:46 am
hi hope this helps
DROP TABLE IF EXISTS SampleData;
CREATE TABLE SampleData
(
col1 NVARCHAR(max)
);
INSERT INTO SampleData
(col1)
select '10.4.'
union all
select '12.1.4'
union all
select '13.789'
union all
select '90.1'
t-sql solution
select * from sampledata where len(col1) - len(replace(col1, '.',...
May 21, 2026 at 2:42 am
hi hope this helps
CREATE TABLE locations (
id INT PRIMARY KEY IDENTITY(1,1),
latitude FLOAT NOT NULL,
longitude FLOAT NOT NULL
);
INSERT INTO locations (latitude, longitude)
VALUES
(45.123456, -111.123456), -- Center point
(45.200000, -111.200000), -- Nearby
(45.500000, -111.500000), --...
May 8, 2026 at 6:04 am
Viewing 9 posts - 16 through 25 (of 25 total)