Friday, March 23, 2012
Problem querying SysObjects and SysIndexes
table in a SQL 2000 database it displays the following error.
SELECT 1 FROM SYSOBJECTS
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'SYSOBJECTS'.
The table does exist and the query is being run as an account with SQL
Admin privileges. This also occurs when trying to query the SysIndexes
table. Other databases on the server are able to query these tables.
What is causing this problem on this one database and how can it be
resolved?Some ideas.
1)Try SELECT 1 FROM sysobjects
2)Try SELECT 1 FROM dbo.sysobjects
--
Jack Vamvas
___________________________________
Need an IT job? http://www.ITjobfeed.com/SQL
"Robin9876" <robin9876@.hotmail.com> wrote in message
news:1190368228.718871.96350@.57g2000hsv.googlegroups.com...
> When executing a basic query against (see below) the system object
> table in a SQL 2000 database it displays the following error.
> SELECT 1 FROM SYSOBJECTS
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'SYSOBJECTS'.
> The table does exist and the query is being run as an account with SQL
> Admin privileges. This also occurs when trying to query the SysIndexes
> table. Other databases on the server are able to query these tables.
> What is causing this problem on this one database and how can it be
> resolved?
>|||> What is causing this problem on this one database and how can it be
> resolved?
Object name case sensitivity is determined by the database collation. I
suspect the following query will return a case-sensitive collation:
SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Robin9876" <robin9876@.hotmail.com> wrote in message
news:1190368228.718871.96350@.57g2000hsv.googlegroups.com...
> When executing a basic query against (see below) the system object
> table in a SQL 2000 database it displays the following error.
> SELECT 1 FROM SYSOBJECTS
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'SYSOBJECTS'.
> The table does exist and the query is being run as an account with SQL
> Admin privileges. This also occurs when trying to query the SysIndexes
> table. Other databases on the server are able to query these tables.
> What is causing this problem on this one database and how can it be
> resolved?
>|||Since posting I had resolved it.
I already thought of the suggestions that Jack posted, it was what Dan
has suggested a particular 3rd party database had been setup as case
sensitive.
On 21 Sep, 12:22, "Dan Guzman" <guzma...@.nospam-online.sbcglobal.net>
wrote:
> > What is causing this problem on this one database and how can it be
> > resolved?
> Object name case sensitivity is determined by the database collation. I
> suspect the following query will return a case-sensitive collation:
> SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Robin9876" <robin9...@.hotmail.com> wrote in message
> news:1190368228.718871.96350@.57g2000hsv.googlegroups.com...
> > When executing a basic query against (see below) the system object
> > table in a SQL 2000 database it displays the following error.
> > SELECT 1 FROM SYSOBJECTS
> > Server: Msg 208, Level 16, State 1, Line 1
> > Invalid object name 'SYSOBJECTS'.
> > The table does exist and the query is being run as an account with SQL
> > Admin privileges. This also occurs when trying to query the SysIndexes
> > table. Other databases on the server are able to query these tables.
> > What is causing this problem on this one database and how can it be
> > resolved?
Tuesday, March 20, 2012
Problem of vale setting
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myConnection As New SqlConnection(ConnectionString)
myConnection.Open()
Dim CommandText As String = "SELECT firstName FROM students Where Students.ID='" & IDinput & "' "
Dim myCommand As New SqlCommand(CommandText, myConnection)
'****this the problem, somthing is mising here******
Dim name As String = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
end sub
The SQL qurey return only one record each time (only one student name with specific ID number)
I want that variable "name" will get the value of the "firstName" filed.
How to do it??Use ExecuteScalar instead of ExecuteReader. ExecuteScalar is designed for situations like this where you want the query to return a single value.
Monday, February 20, 2012
Problem inserting data from IDictionary into Sql2005
Hi,
I'm not sure if this should be in the Sql or VB forums.
Using VS2005 I have a graphics program which holds data in a Dictionary Object.
The data consists of a Key and a Structure called Arrows. This structure holds a startpoint and an endpoint, both of which consist of x and y co-ordinates. I need to insert these four co-ordinates into X,Y,X1 and Y1 columns of a table,
The following Insert statement will insert the correct IdKey and Textbox data, but will not compile the co-ordinates.
I have initialised the Points of the structure, but get the error message that Type is not defined.
With dbCommand
Dim _mstartPoint As Point
Dim _mendPoint As Point
Dim strSql As String
For Each kvp As KeyValuePair(Of String, Arrow) In Arrows
strSql = "INSERT INTO Drawing_Arrows (ArrowId,FlashingCode,X1,Y1,X2,Y2) Values ('" & kvp.Key & "', '" & txt_Title.Text & "','" & CType(Arrows(kvp.Key), _mstartPoint).x.ToString & "', '" & CType(Arrows(kvp.Key), _mstartPoint).y.ToString & "''" & CType(Arrows(kvp.Key), _mendPoint).x.ToString & "', '" & CType(Arrows(kvp.Key), _mendPoint).y.ToString & "')"
.CommandText = strSql
.CommandType = Data.CommandType.Text
.Connection = dbConnection
.ExecuteNonQuery()
Next
End With
My problem is how to extract the _mstartPoint x and _mstartPoint y as seperate items for insertion into X and Y in the table.
Any suggestions welcome.
Tailor
Hi,
Finally figured out the way to do answer this question. use IDictionaryEnumerator. Code as shown, works.
Dim arrowEnumerator As IDictionaryEnumerator = Arrows.GetEnumerator
Do While arrowEnumerator.MoveNext
strSql = "INSERT INTO Drawing_Arrows (ArrowId,FlashingCode,X1,Y1,X2,Y2) Values ('" & _uniqueID & "','" & txt_Title.Text & "','" & CType(arrowEnumerator.Value, Arrow).StartPoint.X.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).StartPoint.Y.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).EndPoint.X.ToString & "', '" & CType(arrowEnumerator.Value, Arrow).EndPoint.Y.ToString & "')"
.CommandText = strSql
.CommandType = Data.CommandType.Text
.Connection = dbConnection
.ExecuteNonQuery()
Loop
Probably no use to anyone else, but posted it in case.
Tailor