By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,605 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

vs.net 2003 edit/create query without designer

P: n/a
using VS.2003...

This has annoyed me endlessly.

I hate the visual query designer in VS.

Is it possible through add-ins or extensions to have query's you want to
edit open in query analyzer, or the text editor in VS, or a dos shell... or
anything other than the designer.

I can't place comments and the "formatting" sucks ass!
--
kevin...
Apr 5 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
What you probably want to use is a Database Project. Its a project
type in VS.NET. It allows you create your scripts and runit against a
connection. I agree with you, the Query Designer doesn't do a good job
with formatting.

Apr 5 '06 #2

P: n/a
tdavisjr,

I am not at work now, but I seem to remember(I could be wrong) that even
with a db project, trying to edit an existing query throws you into the
designer. If there is a way to edit an existing query in a QA type text
window, how do I do that?

thanks
--
kevin...
"tdavisjr" wrote:
What you probably want to use is a Database Project. Its a project
type in VS.NET. It allows you create your scripts and runit against a
connection. I agree with you, the Query Designer doesn't do a good job
with formatting.

Apr 6 '06 #3

P: n/a
Well in a DB project if you have an existing query (*.sql) you have add
it to the project in order to use it. I've worked with DB projects a
little and I don't remember that it was mandatory to use the query
designer, I think it was an option.

Another option would to look into adding an External Tool to VS.NET
with would automatically launch Query Analyzer and passing in the path
to the .sql file and the db login infomation as arguments. This is not
an ideal solution; but to get one you may have to purchase a third
party tool (if it exist) that does exactly what you want.

Apr 6 '06 #4

P: n/a
Your right, to edit a view as text, it needs to be in a db project

I just wrote this macro

Imports EnvDTE
Imports System
Imports System.IO
Imports System.Diagnostics

Public Module kevcoder
Sub OpenWithQueryAnalyzer()
Dim sqlFileName As String
Dim args As String
Dim proc As System.Diagnostics.Process()
Const ISQLW_COMMAND_LINE As String = """C:\Program Files\Microsoft
SQL Server\80\Tools\Binn\isqlw.exe"""
Const ISQL_COMMNAD_ARGS As String = "-E -f "

Dim procInfo As New
System.Diagnostics.ProcessStartInfo(ISQLW_COMMAND_ LINE)

sqlFileName = ActiveDocument.FullName.ToLower
args = ISQL_COMMNAD_ARGS + """" + sqlFileName + """"

' MsgBox("FileName= " + sqlFileName)
'MsgBox("argument = " + args)

procInfo.Arguments = args
procInfo.WindowStyle = ProcessWindowStyle.Maximized

Try
System.Diagnostics.Process.Start(procInfo)
Catch ex As Exception
MsgBox("Could not open " + Path.GetFileName(sqlFileName) + "
with Query Analyzer\n" + ex.ToString())
End Try
End Sub
End Module
--
kevin...
"tdavisjr" wrote:
Well in a DB project if you have an existing query (*.sql) you have add
it to the project in order to use it. I've worked with DB projects a
little and I don't remember that it was mandatory to use the query
designer, I think it was an option.

Another option would to look into adding an External Tool to VS.NET
with would automatically launch Query Analyzer and passing in the path
to the .sql file and the db login infomation as arguments. This is not
an ideal solution; but to get one you may have to purchase a third
party tool (if it exist) that does exactly what you want.

Apr 7 '06 #5

P: n/a
Using a macro wouldn't be the first thig I would have tried. Have you
looked at the External Tools option in VS for launching external
programs? That would have semmed to be a better solution.

Apr 11 '06 #6

P: n/a
Yes I have.
My thought was that with a macro I could hook into the development
environment, specifically the Server Explorer window, and determine the name
of the object selected.
Once I know the object name and type(sp or view) that I can
1. retrieve the text of the sp/view with following tsql (retrieved from
Profiler)
select c.text
from dbo.syscomments c, dbo.sysobjects o
where o.id = c.id and c.id = object_id(N'dbo.MySP')
2. save to a temp file
3. execute isqlw.exe with arguments

I am currently stuck at getting to the Server Explorer Window... but that
will just take a bit more google and reading to find the right object names
--
kevin...
"tdavisjr" wrote:
Using a macro wouldn't be the first thig I would have tried. Have you
looked at the External Tools option in VS for launching external
programs? That would have semmed to be a better solution.

Apr 11 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.