Click here to Skip to main content
15,877,051 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Server connection timeout Pin
SimulationofSai11-Jul-08 4:07
SimulationofSai11-Jul-08 4:07 
GeneralRe: SQL Server connection timeout Pin
dlarkin7711-Jul-08 4:26
dlarkin7711-Jul-08 4:26 
GeneralRe: SQL Server connection timeout Pin
Member 9611-Jul-08 5:46
Member 9611-Jul-08 5:46 
GeneralRe: SQL Server connection timeout Pin
Tomz_KV11-Jul-08 5:48
Tomz_KV11-Jul-08 5:48 
QuestionSystem IP in Stored Procedure Pin
Member 400849210-Jul-08 18:51
Member 400849210-Jul-08 18:51 
AnswerRe: System IP in Stored Procedure Pin
N a v a n e e t h10-Jul-08 22:46
N a v a n e e t h10-Jul-08 22:46 
AnswerRe: System IP in Stored Procedure Pin
DerekFL11-Jul-08 4:50
DerekFL11-Jul-08 4:50 
QuestionInserting data into xml column Pin
DerekFL10-Jul-08 9:45
DerekFL10-Jul-08 9:45 
We have a data feed where we need the authors name description and then all the videos the author made.

I created a table DataFeed (authorId int, name, desc, items xml). I then filled it with all the authors names and descriptions.

I need the items to look like this

"Author"Author Name 1"/Author"
"Item"Video1"/Item"
"Item"Video2"/Item"
"Author"Author Name 2"/Author"
"Item"Video1"/Item"
"Item"Video2"/Item"
"Item"Video3"/Item"

I have a FOR XML query that leoinfo gave me yesterday where I query all videos for a author but when I tried the following I cant get the output because it needs a variable in the query to output to a OUTPUT var....

DECLARE @xml xml
DECLARE @cmd nvarchar(4000)
DECLARE @AuId int
DECLARE @AuName varchar(50)
DECLARE cur_author CURSOR FOR
SELECT AuthorId, AuthorName FROM dbo.DataFeed

OPEN cur_author

FETCH NEXT FROM cur_author INTO @AuId,@AuName

WHILE @@FETCH_STATUS = 0
BEGIN
SET @cmd = [SQL FOR XML Query Videos WHERE AuthorId = @AuId]
EXEC sp_executesql @cmd, @xml OUTPUT
UPDATE dbo.DataFeed SET items = @xml WHERE WHERE AuthorId = @AuId
FETCH NEXT FROM cur_author INTO @AuId,@AuName
END
..

here is the SQL FOR XML Query
'WITH XMLNAMESPACES (''uri1'' as media, ''uri2'' as live)
SELECT RTRIM(Title) AS ''media:title''
, [Description] AS ''media:description''
, Url AS ''live:link''
, DateCreated AS ''media:pubdate''
, thumbnail AS ''media:thumbnail''
FROM dbo.Videos
WHERE AuthorId = ' + '''' + @auId + '''' +'
FOR XML PATH(''item''), ROOT(''root'')'
AnswerRe: Inserting data into xml column Pin
leoinfo10-Jul-08 16:31
leoinfo10-Jul-08 16:31 
JokeRe: Inserting data into xml column Pin
leoinfo10-Jul-08 16:39
leoinfo10-Jul-08 16:39 
GeneralRe: Inserting data into xml column Pin
DerekFL11-Jul-08 4:18
DerekFL11-Jul-08 4:18 
QuestionDTS Stopped working after motherboard change Pin
FrankLepkowski10-Jul-08 8:33
FrankLepkowski10-Jul-08 8:33 
AnswerRe: DTS Stopped working after motherboard change Pin
DerekFL10-Jul-08 8:53
DerekFL10-Jul-08 8:53 
GeneralRe: DTS Stopped working after motherboard change Pin
FrankLepkowski10-Jul-08 8:54
FrankLepkowski10-Jul-08 8:54 
GeneralRe: DTS Stopped working after motherboard change Pin
DerekFL10-Jul-08 9:30
DerekFL10-Jul-08 9:30 
GeneralRe: DTS Stopped working after motherboard change Pin
DerekFL10-Jul-08 9:35
DerekFL10-Jul-08 9:35 
QuestionSelecting from three tables? Pin
NewToAspDotNet10-Jul-08 4:55
NewToAspDotNet10-Jul-08 4:55 
AnswerRe: Selecting from three tables? Pin
leoinfo10-Jul-08 5:05
leoinfo10-Jul-08 5:05 
QuestionExport from Visio to Mysql or From MS Sql Server to mysql Pin
Mohammad Al Hoss10-Jul-08 4:28
Mohammad Al Hoss10-Jul-08 4:28 
QuestionParse values in SQL SP Pin
sqldba10-Jul-08 3:21
sqldba10-Jul-08 3:21 
AnswerRe: Parse values in SQL SP [modified] Pin
leoinfo10-Jul-08 7:18
leoinfo10-Jul-08 7:18 
QuestionPattern matching to list in sql Pin
Member 469462710-Jul-08 2:21
Member 469462710-Jul-08 2:21 
QuestionRe: Pattern matching to list in sql Pin
TheFM23410-Jul-08 4:49
TheFM23410-Jul-08 4:49 
QuestionOPENXML() and performance Pin
Kjetil Svendsen9-Jul-08 22:29
Kjetil Svendsen9-Jul-08 22:29 
AnswerRe: OPENXML() and performance Pin
Ashfield10-Jul-08 1:41
Ashfield10-Jul-08 1:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.