Any SQL people who can help me?

Posted By Message

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Any SQL people who can help me?

I wrote a stored procedure which is a query from 2 tables. I need to output the results from this query to a text file. Can anyone help me?????

Posted 10/15/08 3:22 PM
 
Long Island Weddings
Long Island's Largest Bridal Resource

gregory99
LIF Zygote

Member since 1/07

42 total posts

Name:
Greg

Re: Any SQL people who can help me?

From the windows command prompt :

osql -U user -P password -d database -S servername -Q "select table_name from all_tables" -o c:\sql.txt

Take a look here :
http://www.di-mgt.com.au/osqlUtility.htm

Hope that helps

Posted 10/15/08 3:53 PM
 

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Re: Any SQL people who can help me?

Thanks. Do I put this in a windows script or at the end of my stored procedure in my database?

Posted 10/15/08 3:59 PM
 

gregory99
LIF Zygote

Member since 1/07

42 total posts

Name:
Greg

Re: Any SQL people who can help me?

This would have to go in a windows script.

Posted 10/15/08 4:01 PM
 

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Re: Any SQL people who can help me?

Also...will this work if my select statement is from 2 tables or do I need to dump the data into 1 table?

Posted 10/15/08 4:02 PM
 

gregory99
LIF Zygote

Member since 1/07

42 total posts

Name:
Greg

Re: Any SQL people who can help me?

The number of tables doesn't matter. It will pull in all data that you have in your select statement.

Posted 10/15/08 4:04 PM
 

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Re: Any SQL people who can help me?

I am getting a windows error that select is not a recognizable format....

Posted 10/15/08 4:14 PM
 

gregory99
LIF Zygote

Member since 1/07

42 total posts

Name:
Greg

Re: Any SQL people who can help me?

For some reason I thought you were using SQL Server. What database are you using?

Posted 10/15/08 4:26 PM
 

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Re: Any SQL people who can help me?

I am using SQL server. I created a .bat file and here is the syntax:

Message edited 2008-10-15 17:00:03.290000.

Posted 10/15/08 4:34 PM
 

gregory99
LIF Zygote

Member since 1/07

42 total posts

Name:
Greg

Re: Any SQL people who can help me?

Not sure what is going wrong. I executed the statement from my command line (swapped in my values) and it works. Be sure to watch the line breaks in your bat file.

Try to execute it on the command line outside of the bat file and see if it works.

Posted 10/15/08 4:48 PM
 

luvsun27
Check out my cool glasses

Member since 5/05

8135 total posts

Name:
Kim

Re: Any SQL people who can help me?

I got it to work! Thank you soooo much Chat Icon Chat Icon Chat Icon Chat Icon

Message edited 2008-10-15 16:59:33.900000.

Posted 10/15/08 4:54 PM
 
 

Potentially Related Topics:

Topic Posted By Started Replies Forum
why do people stay so late? VENT AnnBrunoXO 3/20/06 9 Parenting
Things People Never Told You ABout being Pregnant... MrsJ 3/20/06 112 Pregnancy
People who have reflux - HELP Salason 3/19/06 10 Families Helping Families ™
Interesting article in this week's People CathyB 3/18/06 1 Infertility
Levittown People danielleandscott 3/17/06 27 Families Helping Families ™
Why are people shouting outside my office?? VENT Shelly 3/17/06 9 Families Helping Families ™