Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Passing a Table to a Stored Procedure Expand / Collapse
Author
Message
Posted Thursday, August 9, 2007 12:41 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:42 AM
Points: 460, Visits: 2,523
Comments posted here are about the content posted at http://www.sqlservercentral.com/columnists/jSebastian/3182.asp

.
Post #389423
Posted Thursday, August 9, 2007 10:16 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 31, 2010 6:02 PM
Points: 174, Visits: 2,075

Compare the rigidity of this to :

http://beyondsql.blogspot.com/2007/06/dataphor-13-passing-table-as-parameter.html

Post #389511
Posted Sunday, August 12, 2007 12:20 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 31, 2010 6:02 PM
Points: 174, Visits: 2,075

In the thread:
comp.databases.ms-sqlserver
Jul 25, 6:52 am
'Pass Table as a parameter to a function'
httphttp://tinyurl.com/2j4dvy

Joe Celko makes the following comment on passing a table as a parameter to a procedure:

>> Is it possible to pass a table as a parameter to a function.  <<

'Please read a book, any book, on data modeling, and RDBMS.  A table is an entity or a relationship.  That would mean you have a magical,
super function that works on Squids, Automobiles, Britney Spears,
Geographical locations or anything in the whole of creation.'
 
But the super function, reusable functions, is precisely what modern
database developers should have at their disposable! And you can have it:
 
http://beyondsql.blogspot.com/2007/08/dataphor-creating-super-function.html

Post #389991
Posted Tuesday, September 11, 2007 9:46 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, June 21, 2011 10:03 AM
Points: 577, Visits: 102
" That would mean you have a magical,
super function that works on Squids, Automobiles, Britney Spears"

That's a great quote, but I don't think it's necessarily pejorative, as the link states. IE, you already have tables, and tables can be accessed by procedures. Why on earth would you want to pass it in as a variable when it's already in the database and available?

Myself, I find the article very interesting. This sort of language might promote code re-use, elegance, and security. It might even promote set based procedure code instead of the crappy RBAR I see now.



Signature is NULL
Post #398361
Posted Tuesday, September 11, 2007 10:02 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, December 26, 2012 6:08 PM
Points: 18, Visits: 73

This is a very useful feature, we were looking for it in SQL Server for ages. Thank you for discussing it here Jacob.

Post #398362
Posted Wednesday, September 12, 2007 1:47 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 15, 2014 9:56 AM
Points: 24, Visits: 296
Anyone have any idea how this SQL 2008 functionality would/could/can be harnassed within application development ie ASP.net, vb.net, c# ...
Post #398408
Posted Wednesday, September 12, 2007 1:49 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 31, 2010 6:02 PM
Points: 174, Visits: 2,075

Calvin,

You sir are someone who deserves a MySpace as opposed to those who should more approriately be on IJustTakeUpSpace. Your comments are noted and appreciated. Stay tuned, there is much, much more

best,
steve

P.S. A table as a 'variable' is a cornerstone of a 'relational' database
and is a distinguishing concept from an sql table/database. Perhaps this will help:
http://beyondsql.blogspot.com/2007/09/dataphor-all-tables-are-typed-variables.html

P.S. Celko is a sarcastic sob but we get along just fine

Post #398409
Posted Wednesday, September 12, 2007 5:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 9, 2011 4:51 AM
Points: 1, Visits: 10

In the article foolwing sample is used:

   10 INSERT INTO @Items (ItemNumber, Qty)

   11     SELECT '11000', 100 UNION ALL

   12     SELECT '22000', 200 UNION ALL

   13     SELECT '33000', 300

   14 

 

As a small remark: I think we are now in the Katmai world, there we could use a simple INSERT like this:

 

INSERT INTO @Items (ItemNumber, Qty)

VALUES
('11000', 100),

('22000', 200),

('33000', 300)

;

 

Best regards,

Olaf

Post #398438
Posted Wednesday, September 12, 2007 6:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 7:35 AM
Points: 172, Visits: 174

Passing a table to a stored procedure is an interesting idea.  I may have missed something, but doesn't this have an effect on the compiled execution plan for the stored procedure.

Post #398461
Posted Wednesday, September 12, 2007 7:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 21, 2012 10:54 AM
Points: 4, Visits: 30
From my take, this still doesn't solve the problem of passing a table from application development down to the database, with sending several delimited values in seperate variables, Correct?

Garick
http://www.nootz.net
Post #398487
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse