# Connecting store procedures

**URL:** <https://www.ruby-forum.com/t/connecting-store-procedures/109185>\
**Category:** Rails\
**Created:** [July 12, 2007, 8:00am UTC](https://www.ruby-forum.com/t/connecting-store-procedures/109185 "2007-07-12T08:00:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnold](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@Arnold](https://www.ruby-forum.com/u/Arnold)\
**Post date:** [July 12, 2007, 8:00am UTC](https://www.ruby-forum.com/t/connecting-store-procedures/109185/1 "2007-07-12T08:00:22Z")

</div>

Hello everybody,

I am new to Ruby, I am a developer using .NET . I wanted to try ruby  
out, and till now I find it usefull.  
Though I have 3 questions, that I would require some assistance,

I am using SQL-Server 2000 as database along with Ruby on Rails.

1. Can we write stored procedures in the database itself and call it  
from our application? if yes then how ?

2. Is it mandatory to create database tables from the application  
itself ? If we create the tables directly in the database then how can  
we access it from our application?

3. Is it mandatory to provide an id attribute in each database table?  
If we use some other attribute as primary key then how can we access  
that from our application?

I request anyone in this group to provide me with answers to this  
questions.

Thank you

---

<div class="post-metadata">

**Author:** ![Arnold](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@Arnold](https://www.ruby-forum.com/u/Arnold)\
**Post date:** [July 12, 2007, 9:28am UTC](https://www.ruby-forum.com/t/connecting-store-procedures/109185/2 "2007-07-12T09:28:32Z")

</div>

Hello Arnold,

Arnold schrieb:

> 1. Can we write stored procedures in the database itself and call it  
> from our application? if yes then how ?  
> Don’t know much about it, but this could be a hint:  
> [http://wiki.rubyonrails.org/rails/pages/StoredProcedures](http://wiki.rubyonrails.org/rails/pages/StoredProcedures)

> 1. Is it mandatory to create database tables from the application  
> itself ? If we create the tables directly in the database then how can  
> we access it from our application?  
> Just create a model and set the Tablename manually. See  
> ActiveRecord::Base API rdoc

> 1. Is it mandatory to provide an id attribute in each database table?  
> If we use some other attribute as primary key then how can we access  
> that from our application?  
> Again, set it manually but I’d not use anything other than Integers as  
> pkey column type…

Regards  
Florian
