Creating stored procedures with VB.NET

ninel

Active member
Joined
Mar 23, 2005
Messages
32
Location
Land O Lakes, Florida
Programming Experience
3-5
I have to create databases and stored procs based on a user's prompt through a web page.
Is there a way to create a stored proc within VB.NET?

Thanks,
Ninel
 
I need to create a stored procedure that has quite a few statements.
VB.NET:
CREATE PROCEDURE usp_PoliticalProcessing 
AS
UPDATE dbo.list_staging 
SET sPhone = RTrim(LTrim(Convert(varchar(30), Convert(numeric(20, 1), phone))))
UPDATE dbo.list_staging 
SET sPhone = Substring(sphone, 1, patindex('%.%', sphone)-1)
UPDATE  dbo.list_staging 
SET  sphone =  replace(replace(replace(replace(replace(replace(sphone,'.',''),',',''  ),'-',''), ' ',''), '(', ''), ')', '')
ALTER TABLE  dbo.list_staging  ADD [iList_StagingID] INT IDENTITY(1,1)
ALTER TABLE  dbo.list_staging  ADD [sFailedValidation] char(1)
Update dbo.list_staging
SET sFailedValidation = 'X' 
WHERE(Len(RTrim(LTrim(sPhone))) <> 10)
UPDATE a 
SET a.sFailedValidation = 'X'
FROM  dbo.list_staging a 
INNER JOIN   dbo.list_staging b
ON a.sPhone= b.sPhone 
WHERE(a.iList_StagingID > b.iList_StagingID)

I did some research and found that SQL Server doesn't allow statements to be combined in one batch. (You can combine them when using the GO keyword and executing from SQL Query Analyzer or another tool, but not from within code.)

Having said all that, how can I create this proc from within VB.NET?
Is this even possible?

Thanks,
Ninel
 
Back
Top