From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.help Subject: Re: Sql-Mode - getting query results from MS SQL Server 2000 Date: Thu, 16 Jun 2005 19:52:56 +0000 (UTC) Message-ID: References: <20050615192935.GC14624@inkedmn.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1118951902 30700 80.91.229.2 (16 Jun 2005 19:58:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Jun 2005 19:58:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 16 21:58:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dj0Tv-0002uN-Iw for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jun 2005 21:56:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dj0ZO-00040j-Ie for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jun 2005 16:02:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dj0Z6-0003zy-4o for help-gnu-emacs@gnu.org; Thu, 16 Jun 2005 16:02:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dj0Z4-0003zJ-PG for help-gnu-emacs@gnu.org; Thu, 16 Jun 2005 16:02:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dj0Z4-0003yN-Hy for help-gnu-emacs@gnu.org; Thu, 16 Jun 2005 16:02:14 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Dj0Xs-0003dV-3R for help-gnu-emacs@gnu.org; Thu, 16 Jun 2005 16:01:00 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Dj0Qa-0002KE-R5 for help-gnu-emacs@gnu.org; Thu, 16 Jun 2005 21:53:29 +0200 Original-Received: from 204.167.53.87 ([204.167.53.87]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2005 21:53:28 +0200 Original-Received: from mmaug by 204.167.53.87 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2005 21:53:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 38 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 204.167.53.87 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; bkbrel07)) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27508 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27508 Brett Kelly inkedmn.com> writes: > > I've read the SqlMode page on the wiki as well as the sql-help from within > emacs, but I still can't figure out how to do this. > > I'd like to be able to type in a sql query and have it return a resultset in a > different buffer (a la Query Analyzer). Here's what I'm doing now: > - Create a new buffer, do M-x sql-ms RET, then enter the relevant connection > information (user, password, server, dbname). This gives me no errors. > - Type in my SQL statement (I've tried simple "select" statements, as well as > more complicated "create proc" type stuff) > - Highlight the relevant code with the mouse, and choose Send Region from the > SQL menu. > > Now, if I'm understanding this correctly, I should see the results in a new > buffer, but I'm not. The `sql-ms' command should have opened up a new *SQL* buffer to hold the interaction with osql. The results from a sql command you send to the command interpreter from a sql file should appear at the end of the *SQL* buffer. I think you will find the Query Analyzer interaction model doesn't work well in the Emacs environment. In the *SQL* buffer, you have all of Emacs' power to recall and edit sql statements. You can then easily copy tested sql statements from your sql-ms buffer into a sql file script. I also frequently copy the result rows, clean them up some in a scratch buffer and then paste them into other applications. I have been playing around with a feature that will submit a single statement to the SQL command interpreter and displays the results in its own buffer. But it is mostly useful for things like data dictionary listings. If you give me more specific examples of what you want to be able to do and how you want to be able to interact with it, I may be able to offer more assistance. -- Michael Mauger sql.el maintainer