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
Enrique Romero
NA
9
4.7k
if a record exists in the table, run a procedure
Oct 10 2014 12:44 PM
I'm trying to
run a procedure
, once
it finds a record
in a table,
in which
, if you find
the record,
verifies that
record type
is
another
value stored in
another column
,
if not found
,
save a
data in a
variable that is already
declared
.
IF Exists(SELECT *
FROM [Roga].[dbo].[RFC_Empresa_Buzon_Fiscal]
WHERE RFC = @eRFC)
SELECT TOP(1)
RTRIM(LTRIM(REPLACE(RFC, ' ', ''))) AS RFC,
RTRIM(LTRIM(Tipo)) AS Tipo,
RTRIM(LTRIM(Razon_Social)) AS Razon
FROM [Roga].[dbo].[RFC_Empresa_Buzon_Fiscal]
WHERE RTRIM(LTRIM(REPLACE(RFC, ' ', ''))) LIKE @eRFC
ELSE
SET
@eRFC = 'RFC No Valido'
This is
what I wear
,
what I need
is that the value
of
the "Tipo" column,
is stored in a
variable,
which
will use
later to
call it from
C
#,
could guide
me
, I'm new
to
SQL
Server.
Thank you
Reply
Answers (
1
)
Unable to create connection with Sql server
User Defined Function in sql server.