MS Sql Get Top xx Blog Record From Umbraco by parameter...
Posted
by ccppjava
on Stack Overflow
See other posts from Stack Overflow
or by ccppjava
Published on 2010-05-26T10:14:48Z
Indexed on
2010/05/26
10:41 UTC
Read the original article
Hit count: 351
Following SQL get what I need:
SELECT TOP (50) [nodeId] FROM [dbo].[cmsContentXml] WHERE [xml] like '%creatorID="29"%' AND [xml] like '%nodeType="1086"%' ORDER BY [nodeId] DESC
I need to pass in the numbers as parameters, so I have follows:
exec sp_executesql N'SELECT TOP (@max) [nodeId] FROM [dbo].[cmsContentXml] WHERE [xml] like ''%creatorID="@creatorID"%'' AND [xml] like ''%nodeType="@nodeType"%'' ORDER BY [nodeId] DESC',N'@max int,@creatorID int,@nodeType int',@max=50,@creatorID=29,@nodeType=1086
which however, returns no record, any idea?
© Stack Overflow or respective owner