TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abraham Olatubosun
NA
471
114.8k
How to Select a Record and use the result to Update
Dec 16 2016 8:51 AM
Dear Code Masters,
This your humble disciple again, humbling saying thank you for all the suggestions and tips that had made my coding improving by the day.
My masters i have a challenge with Stored Procedure, I want to write within my stored procedure an SQL statement that will do the following :
Create
Procedure
InsertDocument
(
@Category nvarchar(1000),
@FileName nvarchar(1500),
@ContentType Nvarchar(1500),
@Data varbinary(
MAX
),
@Description nvarchar(2000)
)
AS
BEGIN
Declare
@mTerm nvarchar(2000)
SET
NOCOUNT
ON
;
set
@mTerm =
"SELECT Description FROM tbl_ElementalCostingRate WHERE Description = "
+@Description
exec
@mTerm
IF (@mTrerm
IS
NOT
Null
)
UPDATE
tbl_ElementalCostingRate
SET
Category=@Category, [fileName]=@FileName,ContentType=@ContentType,mBtye =@Data ,[Description] =@Description
WHERE
[Description] =@Description
ELSE
INSERT
INTO
tbl_ElementalCostingRate (Category,[fileName],ContentType,mBtye,[Description])
VALUES
(@Category,@FileName,@ContentType,@data,@Description)
END
END
I am finding it difficult as i keep getting error any time i rewrite it and try so that is my challenge .
I will appreciate any help to resolve this issue and i will also want any like where i can get tutorial to write such Batch SQL statement like this.
Thank you
Reply
Answers (
1
)
how to set auto fit in excel in sql
convert varchar to int in sql