Groups | Blog | Home
all groups > sql server new users > january 2006 >

sql server new users : run an EXEC within a SELECT query



Jens
1/19/2006 2:03:25 AM
No that not possible, are you able to implement the features of this
proc in a function ? Then the procedure could be called on a row basis.

HTH, jens Suessmeyer.
Jens
1/19/2006 2:49:01 AM
Sorry wrongwording the function could be called NOT the procedure :-)
Daves
1/19/2006 9:48:59 AM
I have this query which selects items from the News table

I want to run a stored proc which cuts the HTMLBody column down too 100
chars and removes html

can I do something like

SELECT DateIn, Title, EXEC CutHtml(HtmlBody) AS CutBody FROM News ...


?

Daves
1/19/2006 11:52:02 AM
well that ought to be ok, I'm using Yukon...

haven't used functions before though, got some short code example?

[quoted text, click to view]

Hugo Kornelis
1/19/2006 9:59:04 PM
[quoted text, click to view]

Hi Daves,

CREATE FUNCTION dbo.CutHtml
(@HtmlBody nvarchar(1000))
RETURNS nvarchar(100)
AS
BEGIN
DECLARE @Result nvarchar(100)
SET @Result = LEFT(@HtmlBody, 100)
-- Insert code to remove html here
RETURN @Result
END
go

SELECT DateIn,
Title,
dbo.CutHtml(HtmlBody) AS CutBody
FROM News
WHERE ...

--
Daves
1/23/2006 4:46:17 PM
great, thx!
[quoted text, click to view]

AddThis Social Bookmark Button