Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a store procedure be written in c# 1

Status
Not open for further replies.

NeilO123

Programmer
Apr 28, 2009
18
US
Can a store procedure be written in c# or Visual Basic using Visual Studio 2005 against a SQL Server 2005?

I need to do a column parsing into other columns within the same row, in a multirow table. I would like to know, if I can convert my code into store procedure. If its possible, are there any samples out there?

Thanks,

NeilO
 
Yes, search for CLR samples in google. On the ASP.NET/SQL Server project I worked on my colleague wrote CLR function to return Hebrew birthday based on the datetime. I don't remember if we had more CLRs.

 
How are you trying to split up this column? It sounds like you have some design concerns to be honest, but if you are stuck with the current design at this point, you might still be better off doing the splitting from T-SQL. You could still use the CLR for things like regular expression searches if that is what you need.

Good Luck,

Alex

[small]----signature below----[/small]
The author of the monograph, a native of Schenectady, New York, was said by some to have had the highest I.Q. of all the war criminals who were made to face a death by hanging. So it goes.

My Crummy Web Page
 
Thanks to all for the prompt response. I did a google search on the topic but what I got back is "how to call store procedure" but not how to write the procedure in C# or Visual Basic. I can not use T-Sql due to limitations and I am stuck with the database design. Agin any help is welcome.

NeilO
 
I can not use T-Sql due to limitations

If you explain your issue (preferably with sample data and expected results), you may be pleasantly surprised at what can be done with pure T-SQL.



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I have to ask why you can't use tsql, (as it is actually pretty flexible), and how you want to parse out this one column into two? What is the basic logic in how it should be done and some example data would be useful as there are some pretty smart people when it comes to manipulating data with tsql kicking around here and a fresh pair of eyes never hurts.

Other than that, have you looked at CLR Stored Procedures?

Rhys

"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
Terry Pratchett
 
To those that wonder why I can not use T-SQL, is because I have column with 70 Charcters that needs to be parse into other columns with diffent type of delimiters and not all in the same order. I there are samples out there than can do it using T-SQL, that will be great.
Here are 2 examples, I have in dicated in brackets[] what I need to extract:
Column 1 contains the entire string as follows:
[Name]-[BA]-[Nam Processing Links]
[Name]-[CA]-Form-[A]-[D]

Each item with the bracket is either copy directly into another column or the results of a comparison, is then copy into another column.

This process needs to be automated. I kown how to write it in Visual Basic or C# but I do not know how to convert it into a store procedure.

Thanks everyone
 
Thanks markros. The book looks like it has what I am looking for.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top