From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Sql-Mode - getting query results from MS SQL Server 2000 Date: 17 Jun 2005 15:53:24 +1000 Message-ID: <87psulpm0b.fsf@tiger.rapttech.com.au> References: <20050615192935.GC14624@inkedmn.com> Reply-To: timx@spamto.devnul.com NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118987397 15267 80.91.229.2 (17 Jun 2005 05:49:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Jun 2005 05:49:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 17 07:49:54 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dj9jR-0002K5-O9 for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Jun 2005 07:49:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dj9oz-0006Zk-Sa for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Jun 2005 01:55:17 -0400 Original-Newsgroups: gnu.emacs.help Original-Lines: 93 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Original-NNTP-Posting-Host: ppp21-36.lns2.syd3.internode.on.net Original-X-Trace: duster.adelaide.on.net 1118987604 59.167.21.36 (17 Jun 2005 15:23:24 +0950) Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!pln-w!lotsanews.com!newsfeed1.mlpsca01.us.to.verio.net!duster.adelaide.on.net!not-for-mail Original-Xref: shelby.stanford.edu gnu.emacs.help:132047 Original-To: help-gnu-emacs@gnu.org 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:27517 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27517 Brett Kelly writes: > Sometime around Thu, Jun 16, 2005 at 12:15:57PM -0600, Kevin Rodgers said: > > Brett Kelly wrote: > > > 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. > > > > From the commentary at the top of sql.el excerpted below, I guess that > > you are typing your SQL statement directly into the sql-interactive-mode > > *SQL* buffer. If you enter them in some other sql-mode buffer, Send > > Region should cause the *SQL* buffer with the results to be displayed > > (see sql-pop-to-buffer-after-send-region). > > > > ;; This file provides a sql-mode and a sql-interactive-mode. The > > ;; interactive mode had to provide a command-line history; the other > > ;; mode had to provide "send region/buffer to SQL interpreter" > > ;; functions. > > > > ;; sql-interactive-mode is used to interact with a SQL interpreter > > ;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer > > ;; is created by calling a SQL interpreter-specific entry function. Do > > ;; *not* call sql-interactive-mode by itself. > > > > ;; sql-mode can be used to keep editing SQL statements. The SQL > > ;; statements can be sent to the SQL process in the SQLi buffer. > > > > -- > > Kevin Rodgers > > > > > > > > _______________________________________________ > > Help-gnu-emacs mailing list > > Help-gnu-emacs@gnu.org > > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs > > > > Kevin - thanks for the reply. Unfortunately, this still doesn't seem to be > working. > > Went through the followig steps: > > - Opened up a .sql file in a new buffer, called TestSQL.sql > - Checked "Pop to SQLi Buffer after Send" in the SQL menu > - ran M-x sql-ms RET which created a new SQLi buffer called *SQL* > - In the TestSQL.sql buffer, i chose Set SQLi buffer from the > SQL menu, and set it to *SQL* > - I wrote a simple select statement in TestSQL.sql, highlighted it, and chose > "send region" from the sql menu. > - In the minibuffer, it says "string sent to buffer *SQL*" > > And that's it, I get no other output beside that. > > -- > Brett Kelly > inkedmn@inkedmn.com > http://inkedmn.com:8000 > GPG Public Key: http://inkedmn.com:8000/stuff/inkedmn.asc Brett, Are you sure emacs is communicating with the SQL process? Keep in mind that emacs cannot/does not communicate directly with the database - it communicates with some program which then communicates with the database. I don't know anything about MS SQL Server, but with Oracle (as an example), Emacs SQL mode communicates with sqlplus, which is Oracle's interface program for entering sql commands. I imagine SQL Server has something similar. You need to ensure that emacs is communicating with this program and the program is in turn communicating with the SQL Server. Tim -- Tim Cross The e-mail address on this message is FALSE (obviously!). My real e-mail is to a company in Australia called rapttech and my login is tcross - if you really need to send mail, you should be able to work it out!