# Where to store SQL Queries in Ruby Console App

**URL:** <https://www.ruby-forum.com/t/where-to-store-sql-queries-in-ruby-console-app/186097>\
**Category:** Ruby\
**Created:** [March 31, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/where-to-store-sql-queries-in-ruby-console-app/186097 "2010-03-31T15:51:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joemanfoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4bbf92/32.png) [@joemanfoo](https://www.ruby-forum.com/u/joemanfoo)\
**Post date:** [March 31, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/where-to-store-sql-queries-in-ruby-console-app/186097/1 "2010-03-31T15:51:45Z")

</div>

Hi  
I’m building out a windows console app that talks to SQL Server 2005.  
I’m coming from an Access world, where the queries are nicely included  
in the front end.

So I’m wondering: what are best practices for storing queries for an  
application? I certainly don’t want to hard-code the queries into the  
application itself. One idea is to store each query in its own file in  
a separate directory and read in those query files on the fly. But I’m  
still left wondering if there is a bettery way to this.

Ideas?

---

<div class="post-metadata">

**Author:** ![joemanfoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4bbf92/32.png) [@joemanfoo](https://www.ruby-forum.com/u/joemanfoo)\
**Post date:** [April 3, 2010, 5:01pm UTC](https://www.ruby-forum.com/t/where-to-store-sql-queries-in-ruby-console-app/186097/2 "2010-04-03T17:01:09Z")

</div>

Joe M. wrote:

> One idea is to store each query in its own file in  
> a separate directory and read in those query files on the fly.

I’ve used such a method numerous times and it has worked well for me.

David

> **[Ruby on Windows](http://rubyonwindows.blogspot.com)**
>
> On using the Ruby programming language on the Microsoft Windows platform

> **[Ruby on Windows](http://rubyonwindows.blogspot.com/search/label/sqlserver)**
>
> On using the Ruby programming language on the Microsoft Windows platform
