SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: Writing CLR Stored Procedures in C# - Returning Data (Part 2)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 06/23/2005 :  16:12:59  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
In Part 1 I covered a simple stored procedure that printed the current date. In this article I'll cover writing a stored procedure to return a recordset back to the client. In the process we'll learn a little bit more about .NET and C# including the SqlConnection, SqlCommand and SqlDataReader classes.

Article Link.

karuna
Aged Yak Warrior

581 Posts

Posted - 06/26/2005 :  02:59:54  Show Profile  Send karuna a Yahoo! Message  Reply with Quote
Hmm...Interesting...Actually I havent looked at both VS.NET 2005 and Sql Server 2005 yet...But what I see from the code is why should I have to do all this to create a stored proc in Sql Server or is it that, this is way it should go and no more T-Sql in Sql Server 2005?

Karunakaran
___________
It's better to be loved and lost, than ever to be loved...
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

USA
4137 Posts

Posted - 06/26/2005 :  12:01:41  Show Profile  Visit graz's Homepage  Reply with Quote
Transact-SQL still exists in SQL Serve 2005. For the types of examples I've shown so far it would probably be best to use T-SQL in those areas. I'm trying to use these types of examples to demonstrate how to code in C#. As a general rule of thumb T-SQL will be better for data access and CLR (C#/VB) will be better to processor intensive tasks (string manipulation, math, etc.). In future articles the examples will get more complex.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

karuna
Aged Yak Warrior

581 Posts

Posted - 06/27/2005 :  01:09:57  Show Profile  Send karuna a Yahoo! Message  Reply with Quote
When I looked at the code first, I thought this is the code we write in an .net application to execute a sql query or to call a stored proc, So why should I do this to write a stored proc.
Now I get your point of demonstrating how to code in C#. Pretty good one. What I didnt understand in that code is, why using pipe there? Any pointers or explanations on that?

Looking forward for complex examples !!!

Karunakaran
___________
It's better to be loved and lost, than ever to be loved...
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

USA
4137 Posts

Posted - 06/27/2005 :  21:34:04  Show Profile  Visit graz's Homepage  Reply with Quote
Did you read the first article (http://www.sqlteam.com/item.asp?ItemID=21927)? The pipe is the way of sending results outside the stored procedure (i.e. back to the whatever called the stored procedure).

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

karuna
Aged Yak Warrior

581 Posts

Posted - 06/27/2005 :  23:54:38  Show Profile  Send karuna a Yahoo! Message  Reply with Quote
I did read the first article.Will check more on pipe.
Thx for the explanation Graz.

Karunakaran
___________
It's better to be loved and lost, than ever to be loved...
Go to Top of Page

mksql
Starting Member

1 Posts

Posted - 08/30/2005 :  12:02:53  Show Profile  Send mksql an AOL message  Send mksql a Yahoo! Message  Reply with Quote
Looking forward to Part 3. Any ETA?
Go to Top of Page

jwaz1999
Starting Member

12 Posts

Posted - 06/29/2007 :  16:38:09  Show Profile  Reply with Quote
The only problem with this post is there is no SPROC created. It's just executing dynamic SQL. Stored procedures provide many advantages over dynamic SQL including security, caching, and speed.

Jeff W.
Go to Top of Page

cdjn
Starting Member

USA
1 Posts

Posted - 07/09/2007 :  23:16:31  Show Profile  Reply with Quote
Hi guys,
I want to create a sp with diferents schemas. VS2005 always create it in dbo schema. Do you know how to create that with diferent schema??

thanks guys,

cdjn.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000