Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to Create a Stored Procedure

Author  Topic 

Storm
Starting Member

10 Posts

Posted - 2010-02-03 : 09:41:38
Can someone write out a stored procedure for me using this sql statement? Also once you give me back the code how do I execute it?

SELECT upper(CAR_TAG) AS cartag
FROM ATTENDEE_EVENT
WHERE(CAR_TAG IS NOT NULL) AND (CAR_TAG <> '') AND (LEN(CAR_TAG) > 5) AND (LEN(CAR_TAG) < 7) AND (CAR_TAG NOT LIKE '% %') AND (CAR_TAG NOT LIKE '%-%')

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-03 : 09:44:03
Create procedure my_proc
as
SELECT upper(CAR_TAG) AS cartag
FROM ATTENDEE_EVENT
WHERE(CAR_TAG IS NOT NULL) AND (CAR_TAG <> '') AND (LEN(CAR_TAG) > 5) AND (LEN(CAR_TAG) < 7) AND (CAR_TAG NOT LIKE '% %') AND (CAR_TAG NOT LIKE '%-%')

GO

You should execute this using

EXEC my_proc

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Storm
Starting Member

10 Posts

Posted - 2010-02-03 : 10:10:59
Great thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-03 : 10:12:09
quote:
Originally posted by Storm

Great thanks


You are welcome

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -