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.Diagnost ics
Public Module kevcoder
Sub OpenWithQueryAn alyzer()
Dim sqlFileName As String
Dim args As String
Dim proc As System.Diagnost ics.Process()
Const ISQLW_COMMAND_L INE As String = """C:\Progr am Files\Microsoft
SQL Server\80\Tools \Binn\isqlw.exe """
Const ISQL_COMMNAD_AR GS As String = "-E -f "
Dim procInfo As New
System.Diagnost ics.ProcessStar tInfo(ISQLW_COM MAND_LINE)
sqlFileName = ActiveDocument. FullName.ToLowe r
args = ISQL_COMMNAD_AR GS + """" + sqlFileName + """"
' MsgBox("FileNam e= " + sqlFileName)
'MsgBox("argume nt = " + args)
procInfo.Argume nts = args
procInfo.Window Style = ProcessWindowSt yle.Maximized
Try
System.Diagnost ics.Process.Sta rt(procInfo)
Catch ex As Exception
MsgBox("Could not open " + Path.GetFileNam e(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.