January 29, 2006 at 5:38 am
@newsTitle varchar(25),
@newsYear varchar(25),
@Newsid int,
@NewsText text -- two parameters used
(
NewsDate,
NewsTitle,
NewsYear,
PageID
)
VALUES
-- @convertedDate,
@newsTitle,
@newsYear,
'News'
)
SELECT @ptrval = TEXTPTR(NewsText) --- text is wrapped in the varaible
FROM tblNews
where NewsID = @Newsid ----Condition
--select @ptrval
WRITETEXT tblNews.NewsText @ptrval @NewsText
COMMIT
-------------------------------------------------------
January 29, 2006 at 5:46 am
Sorry, my colleague has posted this thread earlier.
January 30, 2006 at 10:28 am
( NewsDate, NewsTitle, NewsYear,
PageID )VALUES
( NewsDate, NewsTitle, NewsYear,
NewsText )VALUES
January 30, 2006 at 2:16 pm
I think you are over complicating things. A stored procedure can take a text field as an argument and insert it directly into the table.
create table tblNews
(
NewsID int identity(1,1),
NewsDate varchar(25),
NewsTitle varchar(25),
NewsYear varchar(25),
PageID varchar(25),
NewsText text
)
go
drop PROCEDURE dbo.uspAddNewsRelease
go
CREATE PROCEDURE dbo.uspAddNewsRelease
@newsDate varchar(25),
@newsTitle varchar(25),
@newsYear varchar(25),
@NewsText text -- two parameters used
As
declare @newsid int
INSERT INTO tblNews
(
NewsDate,
NewsTitle,
NewsYear,
PageID,
NewsText
)
VALUES
(
@newsDate,
@newsTitle,
@newsYear,
'News',
@NewsText
)
select @Newsid = @@identity --system varaiable (@@ reads the last id as an auton number - - gets last inserted record
GO
exec uspAddNewsRelease '15 Jan 2006', 'Big News', '2006', 'some really long text..........'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply