473,692 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create View with ADO.NET

Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?
Nov 20 '05 #1
10 8805
Zack,
What does your code look like, specifically the CREATE VIEW statement
itself?

Can you print the CREATE VIEW statement, just before you execute the
ExecuteNonQuery method?

Hope this helps
Jay

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** **@posting.goog le.com...
Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?

Nov 20 '05 #2
The error is in your CREATE VIEW command, not in ADO.NET. Try run the CREATE VIEW command in Query Analyzer

"Zack Sessions" wrote:
Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?

Nov 20 '05 #3
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. ..
Zack,
What does your code look like, specifically the CREATE VIEW statement
itself?

Can you print the CREATE VIEW statement, just before you execute the
ExecuteNonQuery method?
WHile attempting to debug this issue, I added a Debug.WriteLine to
dump the SQL command to create the view which I used to cut and paste
into a Query Analyzer window. A sample create view command would look
like:

CREATE VIEW viewname AS
SELECT col1,
col2,
col3 as NewName,
col4,
col5 as NewName,
col6
FROM tablea

Note the error is that col3 and col5 both have the same alias name.
When you run this command in the Query Analyzer window, you get the
error you expect, that there are two fields with the same name. When I
try to run the command from VB.NET using ADO.NET, no error is
returned, ie, the Catch in a Try/Catch is not raised.










"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** **@posting.goog le.com...
Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?

Nov 20 '05 #4
"Rulin Hong" <Ru*******@disc ussions.microso ft.com> wrote in message news:<E2******* *************** ************@mi crosoft.com>...
The error is in your CREATE VIEW command, not in ADO.NET. Try run the CREATE VIEW command in Query Analyzer
As I mentioned in my original post, I have tried to run the create
view command that is being generated in a Query Analyzer window. That
is how I determined what particular error was being raised. My problem
is when I try to create the same view in VB.NET with ADO.NET, the
Catch in a Try/Catch is not being raised when it should be.

"Zack Sessions" wrote:
Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?

Nov 20 '05 #5
Zack,
Because of the severity level of the you are getting back an InfoMessage is
used instead of an Exception.

You need to handle the SqlConnection.I nfoMessage event, and act accordingly.

Private Sub OnInfoMessage(B yVal sender As Object, ByVal e As
SqlInfoMessageE ventArgs)
Debug.WriteLine (e.ToString)
' consider throwing an exception here.
End Sub

Dim connection As New SqlConnection(c onnectionString )

AddHandler connection.Info Message, AddressOf OnInfoMessage

Const cmdText As String = "CREATE VIEW viewname AS" & _
" SELECT col1," & _
" col2," & _
" col3 as NewName," & _
" col4," & _
" col5 as NewName," & _
" col6" & _
" FROM tablea"
Dim viewCommand As New SqlCommand(cmdT ext, connection)
Try
connection.Open ()
viewCommand.Exe cuteNonQuery()
Finally
connection.Clos e()
End Try

Hope this helps
Jay

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message

news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. ..
Zack,
What does your code look like, specifically the CREATE VIEW statement
itself?

Can you print the CREATE VIEW statement, just before you execute the
ExecuteNonQuery method?


WHile attempting to debug this issue, I added a Debug.WriteLine to
dump the SQL command to create the view which I used to cut and paste
into a Query Analyzer window. A sample create view command would look
like:

CREATE VIEW viewname AS
SELECT col1,
col2,
col3 as NewName,
col4,
col5 as NewName,
col6
FROM tablea

Note the error is that col3 and col5 both have the same alias name.
When you run this command in the Query Analyzer window, you get the
error you expect, that there are two fields with the same name. When I
try to run the command from VB.NET using ADO.NET, no error is
returned, ie, the Catch in a Try/Catch is not raised.










"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** **@posting.goog le.com...
Has anyone tried to create a SQL7 view using the CREATE VIEW command
and ADO.NET? If so, is there a trick in trapping a SQL error when
trying to create the view? I have a VB.NET app that, amoung other
things, can create views based on existing tables and a table of
column name equivalents. If I accidently introduce a column name
equivalent that is the same as another column, I end up with a CREATE
VIEW SQL statement that is in error, if you run it in a query analyzer
window you get an error like the following:

Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
Column names in each view must be unique. Column name 'FOO' in view
'BAR' is specified more than once.

The ExecuteNonQuery is being done inside a Try/Catch but the Catch
ain't catchin' it!!!

Any ideas?

Nov 20 '05 #6
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message news:<#X******* *******@tk2msft ngp13.phx.gbl>. ..
Zack,
Because of the severity level of the you are getting back an InfoMessage is
used instead of an Exception.

You need to handle the SqlConnection.I nfoMessage event, and act accordingly.

Private Sub OnInfoMessage(B yVal sender As Object, ByVal e As
SqlInfoMessageE ventArgs)
Debug.WriteLine (e.ToString)
' consider throwing an exception here.
End Sub

Dim connection As New SqlConnection(c onnectionString )

AddHandler connection.Info Message, AddressOf OnInfoMessage

Const cmdText As String = "CREATE VIEW viewname AS" & _
" SELECT col1," & _
" col2," & _
" col3 as NewName," & _
" col4," & _
" col5 as NewName," & _
" col6" & _
" FROM tablea"
Dim viewCommand As New SqlCommand(cmdT ext, connection)
Try
connection.Open ()
viewCommand.Exe cuteNonQuery()
Finally
connection.Clos e()
End Try

Hope this helps
Jay
Sorry for the delay in responding, been on vacation. This looks
promising. I'll give it a try. Thanks for your response.

Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message

news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. ..
Zack,
What does your code look like, specifically the CREATE VIEW statement
itself?

Can you print the CREATE VIEW statement, just before you execute the
ExecuteNonQuery method?


WHile attempting to debug this issue, I added a Debug.WriteLine to
dump the SQL command to create the view which I used to cut and paste
into a Query Analyzer window. A sample create view command would look
like:

CREATE VIEW viewname AS
SELECT col1,
col2,
col3 as NewName,
col4,
col5 as NewName,
col6
FROM tablea

Note the error is that col3 and col5 both have the same alias name.
When you run this command in the Query Analyzer window, you get the
error you expect, that there are two fields with the same name. When I
try to run the command from VB.NET using ADO.NET, no error is
returned, ie, the Catch in a Try/Catch is not raised.










"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** **@posting.goog le.com...
> Has anyone tried to create a SQL7 view using the CREATE VIEW command
> and ADO.NET? If so, is there a trick in trapping a SQL error when
> trying to create the view? I have a VB.NET app that, amoung other
> things, can create views based on existing tables and a table of
> column name equivalents. If I accidently introduce a column name
> equivalent that is the same as another column, I end up with a CREATE
> VIEW SQL statement that is in error, if you run it in a query analyzer
> window you get an error like the following:
>
> Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
> Column names in each view must be unique. Column name 'FOO' in view
> 'BAR' is specified more than once.
>
> The ExecuteNonQuery is being done inside a Try/Catch but the Catch
> ain't catchin' it!!!
>
> Any ideas?

Nov 20 '05 #7
Zack,
Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?
As I stated, at least tried to state, its because of the severity level of
the message you are getting back from SQL server.

http://msdn.microsoft.com/library/de...ssageTopic.asp

Hope this helps
Jay

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com... "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message

news:<#X******* *******@tk2msft ngp13.phx.gbl>. ..
Zack,
Because of the severity level of the you are getting back an InfoMessage is used instead of an Exception.

You need to handle the SqlConnection.I nfoMessage event, and act accordingly.
Private Sub OnInfoMessage(B yVal sender As Object, ByVal e As
SqlInfoMessageE ventArgs)
Debug.WriteLine (e.ToString)
' consider throwing an exception here.
End Sub

Dim connection As New SqlConnection(c onnectionString )

AddHandler connection.Info Message, AddressOf OnInfoMessage

Const cmdText As String = "CREATE VIEW viewname AS" & _
" SELECT col1," & _
" col2," & _
" col3 as NewName," & _
" col4," & _
" col5 as NewName," & _
" col6" & _
" FROM tablea"
Dim viewCommand As New SqlCommand(cmdT ext, connection)
Try
connection.Open ()
viewCommand.Exe cuteNonQuery()
Finally
connection.Clos e()
End Try

Hope this helps
Jay


Sorry for the delay in responding, been on vacation. This looks
promising. I'll give it a try. Thanks for your response.

Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. ..
> Zack,
> What does your code look like, specifically the CREATE VIEW

statement > itself?
>
> Can you print the CREATE VIEW statement, just before you execute the
> ExecuteNonQuery method?

WHile attempting to debug this issue, I added a Debug.WriteLine to
dump the SQL command to create the view which I used to cut and paste
into a Query Analyzer window. A sample create view command would look
like:

CREATE VIEW viewname AS
SELECT col1,
col2,
col3 as NewName,
col4,
col5 as NewName,
col6
FROM tablea

Note the error is that col3 and col5 both have the same alias name.
When you run this command in the Query Analyzer window, you get the
error you expect, that there are two fields with the same name. When I
try to run the command from VB.NET using ADO.NET, no error is
returned, ie, the Catch in a Try/Catch is not raised.










>
> "Zack Sessions" <zc********@vis ionair.com> wrote in message
> news:db******** *************** **@posting.goog le.com...
> > Has anyone tried to create a SQL7 view using the CREATE VIEW command > > and ADO.NET? If so, is there a trick in trapping a SQL error when
> > trying to create the view? I have a VB.NET app that, amoung other
> > things, can create views based on existing tables and a table of
> > column name equivalents. If I accidently introduce a column name
> > equivalent that is the same as another column, I end up with a CREATE > > VIEW SQL statement that is in error, if you run it in a query analyzer > > window you get an error like the following:
> >
> > Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
> > Column names in each view must be unique. Column name 'FOO' in view > > 'BAR' is specified more than once.
> >
> > The ExecuteNonQuery is being done inside a Try/Catch but the Catch
> > ain't catchin' it!!!
> >
> > Any ideas?

Nov 20 '05 #8
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message news:<uG******* *******@TK2MSFT NGP12.phx.gbl>. ..
Zack,
Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?
As I stated, at least tried to state, its because of the severity level of
the message you are getting back from SQL server.


I think you misunderstood my question. If the CREATE VIEW has a severe
enough error in the syntax to cause the command to completely fail,
how come just an info message is being raised and not a more severe
error? Seems like the severity level of this particular error should
be higher since the command failed to complete.

http://msdn.microsoft.com/library/de...ssageTopic.asp

Hope this helps
Jay

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message

news:<#X******* *******@tk2msft ngp13.phx.gbl>. ..
Zack,
Because of the severity level of the you are getting back an InfoMessage is used instead of an Exception.

You need to handle the SqlConnection.I nfoMessage event, and act accordingly.
Private Sub OnInfoMessage(B yVal sender As Object, ByVal e As
SqlInfoMessageE ventArgs)
Debug.WriteLine (e.ToString)
' consider throwing an exception here.
End Sub

Dim connection As New SqlConnection(c onnectionString )

AddHandler connection.Info Message, AddressOf OnInfoMessage

Const cmdText As String = "CREATE VIEW viewname AS" & _
" SELECT col1," & _
" col2," & _
" col3 as NewName," & _
" col4," & _
" col5 as NewName," & _
" col6" & _
" FROM tablea"
Dim viewCommand As New SqlCommand(cmdT ext, connection)
Try
connection.Open ()
viewCommand.Exe cuteNonQuery()
Finally
connection.Clos e()
End Try

Hope this helps
Jay


Sorry for the delay in responding, been on vacation. This looks
promising. I'll give it a try. Thanks for your response.

Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
> "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. .. > > Zack,
> > What does your code look like, specifically the CREATE VIEW statement > > itself?
> >
> > Can you print the CREATE VIEW statement, just before you execute the
> > ExecuteNonQuery method?
>
> WHile attempting to debug this issue, I added a Debug.WriteLine to
> dump the SQL command to create the view which I used to cut and paste
> into a Query Analyzer window. A sample create view command would look
> like:
>
> CREATE VIEW viewname AS
> SELECT col1,
> col2,
> col3 as NewName,
> col4,
> col5 as NewName,
> col6
> FROM tablea
>
> Note the error is that col3 and col5 both have the same alias name.
> When you run this command in the Query Analyzer window, you get the
> error you expect, that there are two fields with the same name. When I
> try to run the command from VB.NET using ADO.NET, no error is
> returned, ie, the Catch in a Try/Catch is not raised.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> >
> > "Zack Sessions" <zc********@vis ionair.com> wrote in message
> > news:db******** *************** **@posting.goog le.com...
> > > Has anyone tried to create a SQL7 view using the CREATE VIEW command > > > and ADO.NET? If so, is there a trick in trapping a SQL error when
> > > trying to create the view? I have a VB.NET app that, amoung other
> > > things, can create views based on existing tables and a table of
> > > column name equivalents. If I accidently introduce a column name
> > > equivalent that is the same as another column, I end up with a CREATE > > > VIEW SQL statement that is in error, if you run it in a query analyzer > > > window you get an error like the following:
> > >
> > > Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
> > > Column names in each view must be unique. Column name 'FOO' in view > > > 'BAR' is specified more than once.
> > >
> > > The ExecuteNonQuery is being done inside a Try/Catch but the Catch
> > > ain't catchin' it!!!
> > >
> > > Any ideas?

Nov 20 '05 #9
Zack,
I did not misunderstood you.

Think about what I stated & what the link says:

You are getting an InfoMessage event, the InfoMessage event is raised for
certain levels. Ergo?
I agree I would expect a "failed" CREATE VIEW to be a higher level, your
original code suggests it is:
> > > > Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
> > > > Column names in each view must be unique. Column name 'FOO' in
I will try to find more info, as this seems to be a bug in either what SQL
Server is returning or how ADO.NET is interpreting it... Of course it may be
as simple as a connection setting...

While I'm looking, you may try asking "down the hall" in the
microsoft.publi c.dotnet.framew ork.adonet newsgroup or possible even one of
the SQL Server programming newsgroups, as I would expect (hope) they would
have more experience with executing commands and getting exceptions vs
informessages back...

Hope this helps
Jay
"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message

news:<uG******* *******@TK2MSFT NGP12.phx.gbl>. ..
Zack,
Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?


As I stated, at least tried to state, its because of the severity level of the message you are getting back from SQL server.


I think you misunderstood my question. If the CREATE VIEW has a severe
enough error in the syntax to cause the command to completely fail,
how come just an info message is being raised and not a more severe
error? Seems like the severity level of this particular error should
be higher since the command failed to complete.

http://msdn.microsoft.com/library/de...ssageTopic.asp
Hope this helps
Jay

"Zack Sessions" <zc********@vis ionair.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in
message news:<#X******* *******@tk2msft ngp13.phx.gbl>. ..
> Zack,
> Because of the severity level of the you are getting back an
InfoMessage is
> used instead of an Exception.
>
> You need to handle the SqlConnection.I nfoMessage event, and act

accordingly.
>
> Private Sub OnInfoMessage(B yVal sender As Object, ByVal e As
> SqlInfoMessageE ventArgs)
> Debug.WriteLine (e.ToString)
> ' consider throwing an exception here.
> End Sub
>
> Dim connection As New SqlConnection(c onnectionString )
>
> AddHandler connection.Info Message, AddressOf OnInfoMessage
>
> Const cmdText As String = "CREATE VIEW viewname AS" & _
> " SELECT col1," & _
> " col2," & _
> " col3 as NewName," & _
> " col4," & _
> " col5 as NewName," & _
> " col6" & _
> " FROM tablea"
>
>
> Dim viewCommand As New SqlCommand(cmdT ext, connection)
> Try
> connection.Open ()
> viewCommand.Exe cuteNonQuery()
> Finally
> connection.Clos e()
> End Try
>
> Hope this helps
> Jay

Sorry for the delay in responding, been on vacation. This looks
promising. I'll give it a try. Thanks for your response.

Can you tell me why an infomessage is being raised and not an
exception if the create view command contains an error?

>
> "Zack Sessions" <zc********@vis ionair.com> wrote in message
> news:db******** *************** ***@posting.goo gle.com...
> > "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in

message
news:<#5******* *******@TK2MSFT NGP11.phx.gbl>. ..
> > > Zack,
> > > What does your code look like, specifically the CREATE VIEW

statement
> > > itself?
> > >
> > > Can you print the CREATE VIEW statement, just before you execute

the > > > ExecuteNonQuery method?
> >
> > WHile attempting to debug this issue, I added a Debug.WriteLine to
> > dump the SQL command to create the view which I used to cut and paste > > into a Query Analyzer window. A sample create view command would look > > like:
> >
> > CREATE VIEW viewname AS
> > SELECT col1,
> > col2,
> > col3 as NewName,
> > col4,
> > col5 as NewName,
> > col6
> > FROM tablea
> >
> > Note the error is that col3 and col5 both have the same alias name. > > When you run this command in the Query Analyzer window, you get the > > error you expect, that there are two fields with the same name. When I > > try to run the command from VB.NET using ADO.NET, no error is
> > returned, ie, the Catch in a Try/Catch is not raised.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > >
> > > "Zack Sessions" <zc********@vis ionair.com> wrote in message
> > > news:db******** *************** **@posting.goog le.com...
> > > > Has anyone tried to create a SQL7 view using the CREATE VIEW

command
> > > > and ADO.NET? If so, is there a trick in trapping a SQL error when > > > > trying to create the view? I have a VB.NET app that, amoung other > > > > things, can create views based on existing tables and a table of > > > > column name equivalents. If I accidently introduce a column name > > > > equivalent that is the same as another column, I end up with a

CREATE
> > > > VIEW SQL statement that is in error, if you run it in a query

analyzer
> > > > window you get an error like the following:
> > > >
> > > > Server: Msg 4506, Level 16, State 1, Procedure BAR, Line 2
> > > > Column names in each view must be unique. Column name 'FOO' in

view
> > > > 'BAR' is specified more than once.
> > > >
> > > > The ExecuteNonQuery is being done inside a Try/Catch but the Catch > > > > ain't catchin' it!!!
> > > >
> > > > Any ideas?

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1779
by: kackson | last post by:
Hi. I created a simple view with the following statements: CREATE VIEW dbo.VIEW1 AS SELECT dbo.VIEW_ALL.ID, dbo.VIEW_ALL.Code, Another.dbo.OTHER_VIEW.Label as SpecialCode FROM dbo.VIEW_ALL LEFT OUTER JOIN
4
8091
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure creates a string of custom SQL statement and returns this string back to the main stored procedure. This SQL statements work fine on there own. The SQL returned from the sub stored procedure are returned fine. The datatype of the variable that...
3
2324
by: T Tran via SQLMonster.com | last post by:
Hi Gurus, I'm a beginner. Would you please tell me if it's possible to create a view having a calcuated column based on the condition of the column on the sql table. create view vwImaging AS select EmpID, LastName, FirstName, EmpTag = 'Act' if FROM tblPerPay
3
5179
by: Mike Schuler | last post by:
Hello, I thought I knew sql, but when I send this as an argument of a Statement.execute(): create view mike.unnamed1(WORKDEPT) as select f1.WORKDEPT as \"WORKDEPT\"\r\nfrom MIKE.EMPLOYEE f1\r\nfor read only\r\n I get: SQL0104N An unexpected token \"create view
0
1868
by: dermot | last post by:
I have an MS Access ADP project linked to a SQL Server database. When a particular user tries to create a view she gets an error saying 'ADO error 'create view' does not allow specifying the database name as a prefix to the object name' Username = Jenny.Taggart
0
1364
by: dermot | last post by:
I have an MS Access ADP project linked to a SQL Server database. When a particular user tries to create a view she gets an error saying 'ADO error 'create view' does not allow specifying the database name as a prefix to the object name' Username = Jenny.Taggart I ran a profiler trace to see what the error was. The SQL that is called CREATE VIEW Jenny.Taggart.JENNYTEST AS SELECT * From dbo.Accident
2
3777
by: Karsten | last post by:
Hi, I want to create dynamic reports with C# and MS SQL-Server 2005 Reporting Services. Since the reporting service uses a data-table or data-view, I want to create a view dynamically. How can I create a data-view on a MS SQL-Server 2005 with C#? Thanks for your help!
4
22709
by: cognosqueen | last post by:
I need to create a view of a sql table, but change the data types. I know the syntax below is not correct, and can't figure out if it is wrong or if you just can't do this. I have only created views before with the same data type. CREATE VIEW F0005New(DRKY nchar(3), DRDL01 nchar(30)) INSERT (SELECT rtrim(F0005.DRKY), F0005.DRDL01 FROM F0005 AS F0005 WHERE DRSY = '41' AND DRRT = 'S1')
7
5892
by: alessandro menchini | last post by:
Hello, First of all: i apologize for my english...i'm still learning... If i create a view it seems that DB2 manage this view like an updateable view. But I need to create a view "read only", so DB2 never enables lock on any record... How can i do that?
0
8603
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9083
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8960
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4323
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2237
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.