Viewing 15 posts - 271 through 285 (of 2,458 total)
Because the only text that you are dealing with is alphanumeric, you can change FOR XML PATH(''), TYPE).value('.', 'varchar(max)'), 1, 1, '')
to FOR XML PATH('')), 1, 1,...
-- Itzik Ben-Gan 2001
May 1, 2017 at 4:51 pm
Regarding your first question about the DBA position.. I like try to feel them out to understand if I'm replacing someone or filling a new position and why. Often a...
-- Itzik Ben-Gan 2001
April 28, 2017 at 11:36 am
No problem!
-- Itzik Ben-Gan 2001
April 27, 2017 at 10:24 am
-- Itzik Ben-Gan 2001
April 27, 2017 at 8:31 am
This can be improved but here's one way: WITH piv AS
(
SELECT
AID,
name1 = MAX(CASE [name] WHEN 'LN' THEN [name] END),
name2 =...
-- Itzik Ben-Gan 2001
April 27, 2017 at 7:36 am
Your double quotes don't look right they look like ASCII-148's whereas you want ASCII-34's. Try this:
SELECT
event_xml.value('(./@name)', 'varchar(1000)') as event_name,
event_xml.value('(./data[@name="database_id"]/value)[1]', 'int')...
-- Itzik Ben-Gan 2001
April 26, 2017 at 12:09 pm
-- Itzik Ben-Gan 2001
April 25, 2017 at 8:07 am
-- Itzik Ben-Gan 2001
April 24, 2017 at 4:25 pm
Your first Xpath Expression for Item/ItemNumber is wrong
Instead of N.value('(Item/ItemNumber[1])','int')
You want N.value('(Item/ItemNumber)[1]','int')
declare @packXML XML = '<Pack>
<PackID>1</PackID>
...
-- Itzik Ben-Gan 2001
April 24, 2017 at 3:24 pm
Building off Thom's solution, you could do something like this (note that I can't test this as I don't have an SSRS DB available)
WITH getxml AS
-- Itzik Ben-Gan 2001
April 19, 2017 at 1:27 pm
I'm not sure about this but, for a user to see object info they would need VIEW DEFINITION rights at the DB, Schema and Object level. Does this help?
-- Itzik Ben-Gan 2001
April 14, 2017 at 3:55 pm
-- Itzik Ben-Gan 2001
April 14, 2017 at 3:41 pm
Yes, loops bad. Set-based good.
First for some sample data:IF OBJECT_ID('tempdb..#stu') IS NOT NULL DROP TABLE #stu;
CREATE TABLE #stu(nid int NULL, student_name varchar(100) NOT NULL);
-- Itzik Ben-Gan 2001
April 14, 2017 at 3:17 pm
I'm a little late here but I have a function that is designed for exactly this type of thing. If you grab a copy on NGrams8k you could create...
-- Itzik Ben-Gan 2001
April 14, 2017 at 2:56 pm
-- Itzik Ben-Gan 2001
April 12, 2017 at 8:31 am
Viewing 15 posts - 271 through 285 (of 2,458 total)