Showing posts with label analyzer. Show all posts
Showing posts with label analyzer. Show all posts

Sunday, February 12, 2012

Accessing Query analyzer Messages programmatically

I would like to access the results posted to the Messages tab of Query Analyzer via code. I had assumed this was possible using ADO, but I am not having any luck.

Here is the example that I would like to use:

-- This T-SQL returns a simple report
DECLARE @.Foo Datetime

SELECT @.Foo = GetDate()

Print @.Foo
Print ''
Print 'Another line of text'
Print ''
Print 'End of report'

When I try opening this as an ADODB recordset, the recordset come back closed.

I'm scratching my head trying to think of other ways to do this, and I keep coming up blank.

Any ideas?see ADODB.Connection.Errors collection

?ADODB.Connection.Errors.Item(0).Description

Thursday, February 9, 2012

Accessing network drive from SQL Analyzer

Not sure if this posted or not before, so just in case, I'm doing it again.
I have SQL2000 on a Win2000 server. Using windows explorer, I have mapped a
network drive to letter "F"
While in SQL Analyzer, I'm trying to access "F" but I can't. I can access C
and D which are local drives, but not F.
If you are curious, I'm trying to access it by simply doing xp_cmdshell 'dir
f:'
Once this works, I'm planning to use a restore operation which we will read
from that drive.
Does anyone know how to access a mapped network drive from SQL Analyzer? It
will greatly appreciated.
thanks,
PPHi
Did you log onto the SQL Server using the SQL Server service account, map
the drive and then log off again?
If not, that is the way you should do it.
Generally, it is best to use UNC naming (\\machinename\sharename\) when
accessing resources over the network.
Backup and restores have to be done via UNC paths as mapped drives are not
supported for those operations.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"PP" <PP@.discussions.microsoft.com> wrote in message
news:422C6736-9887-450A-B83D-3F7A9B30799B@.microsoft.com...
> Not sure if this posted or not before, so just in case, I'm doing it
> again.
> I have SQL2000 on a Win2000 server. Using windows explorer, I have mapped
> a
> network drive to letter "F"
> While in SQL Analyzer, I'm trying to access "F" but I can't. I can access
> C
> and D which are local drives, but not F.
> If you are curious, I'm trying to access it by simply doing xp_cmdshell
> 'dir
> f:'
> Once this works, I'm planning to use a restore operation which we will
> read
> from that drive.
> Does anyone know how to access a mapped network drive from SQL Analyzer?
> It
> will greatly appreciated.
> thanks,
> PP