Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Monday, March 26, 2012

Problems with SQL 2005 IDE and Column Names

Hello all.

I'm having problems with SQL 2005 Management Studio not liking some of my column names, even though I believe they are valid when run directly through a SQL query window. An example...

CREATE TABLE [Test](
[ID] [int] NOT NULL,
[The.Name] [nvarchar](50) NULL )

INSERT INTO [Test] ( [ID], [The.Name]) VALUES (1, 'Test')

DELETE FROM [Test] WHERE [ID] = 1

This SQL will execute in the Query window without issue. To see the problem in action...

    Execute the SQL to CREATE the table and INSERT the row Use the Management Studio IDE to Right-Click on the Test table and "Open Table" Highlight the row in the new results window Try to delete the row See the error message: The multi-part identifier "The.Name" could not be bound

It's confusing me because, as far as I am able to determine, the column name is valid SQL and was even created in the IDE. Ultimately I can work around this by either working directly in SQL or simply renaming the column, but both options would be an impact on our project schedule. If anyone could provide some insight it would be greatly appreciated.

Much thanks.

Unfortunately it looks like you have uncovered a bug in Management Studio. I have filed it against the product team.|||

This bug is under consideration for being fixed in sql server 2005 SP2. You can track the bug at

http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=05843594-1bcf-4b5b-a51e-cfae51b27007

Problems with SQL 2000 and 2005 on same machine - Can't connect on 2000

Hi,
i have SQL 2000 and 2005 on same machine(with different intance names,
of course), my laptop - XP with SP2. The 2005 works fine but i can't
connect on SQL 2000. All the the SQL services are started.
Any idea? Have i to reinstall 2000?
Tks,
LourivalAre both named instances or is one for them default instance and if so, whic
h is the default
instance? Is the SQL Server browser service started?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142254900.463560.180690@.e56g2000cwe.googlegroups.com...
> Hi,
> i have SQL 2000 and 2005 on same machine(with different intance names,
> of course), my laptop - XP with SP2. The 2005 works fine but i can't
> connect on SQL 2000. All the the SQL services are started.
> Any idea? Have i to reinstall 2000?
> Tks,
> Lourival
>|||one of then is the default instance, the 2000. The 2005 instance is
named.
tks,
Tibor|||So what error do you get when you run the following from a command prompt
osql -E -S (local)
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegroups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>|||No error. It just became freezed. It=B4s the same for enterprise manager
or any app that try to connect.
regards,
Lourival|||OK, I thought it might be the SQL Browser service not started, but that shou
ld mean you can connect
to the default but not named. You seem to have the other way around. One mor
e thing you can check is
the netlib configuration. Except for that, I'm out of ideas, I'm afraid.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegroups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>sql

Problems with SQL 2000 and 2005 on same machine - Can't connect on 2000

Hi,
i have SQL 2000 and 2005 on same machine(with different intance names,
of course), my laptop - XP with SP2. The 2005 works fine but i can't
connect on SQL 2000. All the the SQL services are started.
Any idea? Have i to reinstall 2000?
Tks,
LourivalAre both named instances or is one for them default instance and if so, which is the default
instance? Is the SQL Server browser service started?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142254900.463560.180690@.e56g2000cwe.googlegroups.com...
> Hi,
> i have SQL 2000 and 2005 on same machine(with different intance names,
> of course), my laptop - XP with SP2. The 2005 works fine but i can't
> connect on SQL 2000. All the the SQL services are started.
> Any idea? Have i to reinstall 2000?
> Tks,
> Lourival
>|||one of then is the default instance, the 2000. The 2005 instance is
named.
tks,
Tibor|||So what error do you get when you run the following from a command prompt
osql -E -S (local)
--
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegroups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>|||No error. It just became freezed. It=B4s the same for enterprise manager
or any app that try to connect.
regards,
Lourival|||OK, I thought it might be the SQL Browser service not started, but that should mean you can connect
to the default but not named. You seem to have the other way around. One more thing you can check is
the netlib configuration. Except for that, I'm out of ideas, I'm afraid.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegroups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>

Problems with SQL 2000 and 2005 on same machine - Can't connect on 2000

Hi,
i have SQL 2000 and 2005 on same machine(with different intance names,
of course), my laptop - XP with SP2. The 2005 works fine but i can't
connect on SQL 2000. All the the SQL services are started.
Any idea? Have i to reinstall 2000?
Tks,
Lourival
Are both named instances or is one for them default instance and if so, which is the default
instance? Is the SQL Server browser service started?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142254900.463560.180690@.e56g2000cwe.googlegr oups.com...
> Hi,
> i have SQL 2000 and 2005 on same machine(with different intance names,
> of course), my laptop - XP with SP2. The 2005 works fine but i can't
> connect on SQL 2000. All the the SQL services are started.
> Any idea? Have i to reinstall 2000?
> Tks,
> Lourival
>
|||one of then is the default instance, the 2000. The 2005 instance is
named.
tks,
Tibor
|||So what error do you get when you run the following from a command prompt
osql -E -S (local)
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegr oups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>
|||No error. It just became freezed. It=B4s the same for enterprise manager
or any app that try to connect.
regards,
Lourival
|||OK, I thought it might be the SQL Browser service not started, but that should mean you can connect
to the default but not named. You seem to have the other way around. One more thing you can check is
the netlib configuration. Except for that, I'm out of ideas, I'm afraid.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<lourivalsjr@.gmail.com> wrote in message
news:1142270454.932906.302490@.j33g2000cwa.googlegr oups.com...
> one of then is the default instance, the 2000. The 2005 instance is
> named.
> tks,
> Tibor
>

Problems with SQL 2000 and 2005 on same machine - Cant connect on 2000

Hi,
i have SQL 2000 and 2005 on same machine(with different intance names,
of course), my laptop - XP with SP2. The 2005 works fine but i can't
connect on SQL 2000. All the the SQL services are started.

Any idea? Have i to reinstall 2000?

Tks,
Lourival(lourivalsjr@.gmail.com) writes:
> i have SQL 2000 and 2005 on same machine(with different intance names,
> of course), my laptop - XP with SP2. The 2005 works fine but i can't
> connect on SQL 2000. All the the SQL services are started.
> Any idea? Have i to reinstall 2000?

Exactly which service-pack level of SQL 2000 do you have? You can view
this on the first line of
C:\Program Files\Microsoft SQL Server\MSSQL\LOG\ERRORLOG
(if this is the instance directory for SQL 2000.)

I believe you need at least SP3 (8.00.760 to run in parallel with SQL 2005.)

Another thing to try is to open the Server and Client Network Utilities of
SQL 2000, and make sure that both use TCP/IP. For local connections,
shared memory is the default, but if it for some reason does not work, you
can try TCP/IP.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Saturday, February 25, 2012

problems with < or > string values

I have a query that is trying to find all of the names that fall between a low and high value. I'm using CHR(10) for the low value and this seems to work, but using a '{' for the high value does not. I chose '{' because it is one higher then 'z' in the ASCII charts. So the query looks something like this.

SELECT * FROM People where LastName > @.LastNameLow and LastName < @.LastNameHigh

The parameter values are built in .Net code and passed to the stored proceedure. @.LastNameLow is a string of CHR(10) values whose length is equal to the column length. @.LastNameHigh is a string of '{' characters whose length is equal to the column length.

When I run this query, I get no rows returned. However if I change the '{' character to 'z' character, it does return rows. However I don't want to use 'z' because the query is <, not <=. And before you ask, no I cant change it. I've tried '|', '}' and '~', all of which are valid ASCII values above 'z' and valid printable characters, but none of them seem to work in this case.

Any help would be appreciated.

Bill

you want a default LOWEST and HIGHEST value when user does not specify any value is it ?

why not pass in NULL value to @.LastNameLow or @.LastName High if user does not specify any Low or High value

SELECT *
FROM People
WHERE LastName >= coalesce(@.LastNameLow , LastName)
AND LastName <= coalesce(@.LastNameHigh, LastName)|||

A variation on K H Tan's solution (passing in Null when there is no upper or lower limit) is:

SELECT *
FROM People
WHERE ((LastName > @.LastNameLow) OR (@.LastNameLow IS NULL)) AND
((LastName < @.LastNameHigh) OR (@.LastNameHigh IS NULL))

Or if you have to take a string value instead then assuming you use say '@.#@.' as the no limit token then you can use the query:

SELECT *
FROM People
WHERE ((LastName > @.LastNameLow) OR (@.LastNameLow = '@.#@.')) AND
((LastName < @.LastNameHigh) OR (@.LastNameHigh = '@.#@.'))

You can use any token that would not be provided as a legitimate range value. I hope this helps.

|||

Not exactly. This kind of query is essentially being used as a LIKE statement. For instance if the user wants to search last names and enters 'SM' for the value, the parameters would code up to be 'SM'+chr(10)+chr(10)...+chr(10) for @.LastNAme Low and 'SM{{{{...{{{' for @.LastNameHigh. the intent is to return all last names that begin with 'SM'. Like I've said though, I don't really have control over the query and can't change it to a LIKE, so I'm trying to find values that will work. If @.LastNAmeHigh is 'SM{{{{...{{{' we get 0 rows returned, but if @.LastNameHigh is 'SMzzzzzz...zzzz' it does get some rows.

I know this must have something to do with the coallation and sort order set on the sql server. As near as I can tell we are using the default coallation which is Latin 1252 with sort order 52. The LAtin 1252 code page seems to match a traditional ASCII chart, but I have no idea what sort order 52 means or how to tell specifically how it is sorting.

Bill