SQL Case Limit?

Feb 21, 2006

Hi,

Just need to check with you on the following:

sql 2000 sp3 sit in win2003

when we run the quere in server A.. it look okay with case expression more then 10

but when we run query in server B with linkserver to server A

sql server give this message

Msg 8180, Level 16, State 1, Line 1

Statement(s) could not be prepared.

Msg 170, Level 15, State 1, Line 1

Line 1: Incorrect syntax near 'Qry1068'.

Msg 125, Level 15, State 4, Line 1

Case expressions may only be nested to level 10.

select distinct rp.invoice_id,

CASE

WHEN (rp.product_group_code = 2 and c.catelog_id = 1) then 'PG'

WHEN (rp.product_group_code = 2 and c.catelog_id = 3) then 'JB'

WHEN (rp.product_group_code = 9 and c.catelog_id = 1) then 'KL'

WHEN (rp.product_group_code = 9 and c.catelog_id = 2) then 'SG'

WHEN (rp.product_group_code = 9 and c.catelog_id = 3) then 'JB'

WHEN (rp.product_group_code = 8 and c.catelog_id = 1) then 'GEORGETOWN'

WHEN (rp.product_group_code = 3 and c.catelog_id = 2) then 'GENTING'

WHEN (rp.product_group_code not in (2, 3, 8, 9) and c.catelog_id = 1) then 'PERAK'

WHEN (rp.product_group_code not in (2, 3, 8, 9) and c.catelog_id = 2) then 'NS'

WHEN (I.product_code not in (2, 3, 8, 9) and c.catelog_id = 3) then 'KEDAH'

WHEN (I.product_code not in (2, 3, 8, 9) and c.catelog_id = 3) then 'PERLIS'

ELSE ''

END

from a.db1.dbo.invoice rp, a.db1.dbo.contract c

WHERE rp.id=c.id



if i take out of one of the case condition, no error and result come out

I just wonder whether this is sql2000 sp3 bug or limitation using case expression over sql linked server

View 6 Replies


ADVERTISEMENT

SQL Server 2008 :: Change Text Format From Case Sensitive To Case Insensitive?

Aug 31, 2015

How can I change my T-SQL text editor from text sensitive to text insensitive?

View 2 Replies View Related

Case Insensitivity Is On Server Wide: Tables Render Case Sensative...

Jan 6, 2005

Hello:

I have created an SQL server table in the past on a server that was all case sensative. Over time I found out that switching to a server that is not case sensative still caused my data to become case sensative. I read an article that said you should rebuild your master database then re-create your tables. So after rebuilding the master database, a basic restore would not be sufficient? I would have to go and manually re-create every single table again?

Any suggestions?

View 4 Replies View Related

Case Insensitive Searching In Sql Server 2000 When It's Case Sensitive

May 4, 2007

Can someone point me to a tutorial on how to search against a SQL Server 2000 using a case insensitive search when SQL Server 2000 is a case sensitive installation?
 
thanks in advance.

View 3 Replies View Related

HELP! Case Insensitive Database On Case Sensitive Server

Aug 17, 2005

We need to install CI database on CS server, and there are some issueswith stored procedures.Database works and have CI collation (Polish_CI_AS). Server hascoresponding CS collation (Polish_CS_AS). Most queries and proceduresworks but some does not :-(We have table Customer which contains field CustomerID.Query "SELECT CUSTOMERID FROM CUSTOMER" works OK regardless ofcharacter case (we have table Customer not CUSTOMER)Following TSQL generate error message that must declare variable @id(in lowercase)DECLARE @ID INT (here @ID in uppercase)SELECT @id=CustomerID FROM Customer WHERE .... (here @id in lowercase)I know @ID is not equal to @id in CS, but database is CI and tablenames Customer and CUSTOMER both works. This does not work forvariables.I suppose it is tempdb collation problem (CS like a server collationis). I tried a property "Identifier Case Sensitivity" for myconnection, but it is read only and have value 8 (Mixed) by default -this is OK I think.DO I MISS SOMETHING ????

View 4 Replies View Related

Doing A Case-sensitive Query In A Case-insensitive Database

May 29, 2008

I am working in a SQL server database that is configured to be case-insensetive but I would like to override that for a specific query. How can I make my query case-sensitive with respect to comparison operations?

Jacob

View 5 Replies View Related

Transact SQL :: Upper Case To Lower Case Conversion

May 4, 2015

I have column with value of all upper case, for example, FIELD SERVICE, is there anyway, I can convert into Field Service?

View 7 Replies View Related

Can You Use Replication From A Case Sensitive Db To A Case Insensitive Db?

Aug 19, 2007

I am curious with using replication in sql server 2005 one way from db A (source) replicating to db B(destination) in which db A has a collation of CS and db B has a collation of CI.  Will there be any problems with this scenario? Thanks in advance! 

View 2 Replies View Related

Problem Using Result From CASE In Another CASE Statement

Nov 5, 2007

I have a view where I'm using a series of conditions within a CASE statement to determine a numeric shipment status for a given row. In addition, I need to bring back the corresponding status text for that shipment status code.

Previously, I had been duplicating the CASE logic for both columns, like so:




Code Block...beginning of SQL view...
shipment_status =
CASE
[logic for condition 1]
THEN 1
WHEN [logic for condition 2]
THEN 2
WHEN [logic for condition 3]
THEN 3
WHEN [logic for condition 4]
THEN 4
ELSE 0
END,
shipment_status_text =
CASE
[logic for condition 1]
THEN 'Condition 1 text'
WHEN [logic for condition 2]
THEN 'Condition 2 text'
WHEN [logic for condition 3]
THEN 'Condition 3 text'
WHEN [logic for condition 4]
THEN 'Condition 4 text'
ELSE 'Error'
END,
...remainder of SQL view...






This works, but the logic for each of the case conditions is rather long. I'd like to move away from this for easier code management, plus I imagine that this isn't the best performance-wise.

This is what I'd like to do:



Code Block
...beginning of SQL view...
shipment_status =
CASE
[logic for condition 1]
THEN 1
WHEN [logic for condition 2]
THEN 2
WHEN [logic for condition 3]
THEN 3
WHEN [logic for condition 4]
THEN 4
ELSE 0
END,


shipment_status_text =

CASE shipment_status

WHEN 1 THEN 'Condition 1 text'

WHEN 2 THEN 'Condition 2 text'

WHEN 3 THEN 'Condition 3 text'

WHEN 4 THEN 'Condition 4 text'

ELSE 'Error'

END,
...remainder of SQL view...


This runs as a query, however all of the rows now should "Error" as the value for shipment_status_text.

Is what I'm trying to do even currently possible in T-SQL? If not, do you have any other suggestions for how I can accomplish the same result?

Thanks,

Jason

View 1 Replies View Related

Case Sensitivity When A User Enters Data Into The Database. How To Deal With Case Sensitivity.

Sep 6, 2007

I am working on a C#/asp.net web application. The application has a text box that allows a user to enter a name. The name is then saved to the database.
Before the name is saved to the database, I need to be able to check if the name already exists in the database. The problem  here is that what if the name is in the database as "JoE ScMedLap" and somoene enters the name as "Joe Schmedlap" which already exists in the database,but just differs in case.
In other words how do deal with case sensitiviy issues.

View 2 Replies View Related

Restore Of Case Insensitive Database To A Case Sensitive Database - SQL Server 2000

Jul 20, 2005

Yesterday I received a response to my CI/CS Collation problem and therecommendation was to try and restore a CI Collation database to a CSCollation database. After creating a blank CS database a full restore(Force restore over existing database) does change the Collation toCI. I'm unsure as to how I can restore without changing theCollation. Any suggestions?

View 2 Replies View Related

Limit Of DTS?

Jul 6, 2004

Hi there guys!

I was wondering if anyone know the number of rows you can import from an external source into MS SQL Server 2000 Developer Edition?

I have tried importing a whole table from another database with over a million records. But failed after 1.7 million row.

Any ideas?

Thank you!

View 1 Replies View Related

2 GIG Limit

Aug 6, 1998

When creating a database, SQL Server 6.5 seems to have a 2 gig limit. What I mean is that if the device chosen is over 2 gigs SQL Server displays the size of the device as anegative number. This prevents me from being able to expand the database when I need to. Can anyone tell me why this is so, and if there`s anyway around it??

View 1 Replies View Related

Help In Limit

Feb 21, 2006

we all know
mysql: select * from table limit ?1, ?2

equals

sqlserver: SELECT TOP ?2 *
FROM table WHERE (IDENTITYCOL NOT IN
(SELECT TOP ?1 IDENTITYCOL
FROM table order by IDENTITYCOL))
order by IDENTITYCOL

but the below SQL in mysql,how to convert?I enmesh...........
select pageid,pagename,pageaddr,pageauditflag,pageartaudi tflag,startplaytime
from pageinfo where entryid= ?1 and startplaytime= ?2
limit ?3, ?4

thanks!

View 14 Replies View Related

LIMIT In MS SQL ??!!

Jul 20, 2005

hi,I have a question.Maybe You know the equivalent to command LIMIT from MySQLI couldn`t find something like this in MS SQLPSI try to display 10 records begining form e.g. 4 sort by idsomething like: "SELECT * FROM table WHERE name=... LIMIT 4, 10 ORDER BY id"in MySQLthanx,Urban

View 2 Replies View Related

4gb Limit

Mar 26, 2007

Hi There

I recently read up and found an msdn forum post that said the 4gb limit only applied to data files not log files.

However recently i had an error on a sql express database saying that the log file was full, the database log file was set to auto grow and there was plenty of space left.

So i am guessing the 4gb limit applies to any database file mdf or ldf, is this correct ?

Thanx

View 5 Replies View Related

Limit Data

Jul 10, 2007

I have the fields in my table:
ID, Title, Description, Price, ImageData, Active
I only want it to be possible to have two records at any time with Active=Yes. Active is a Bit, Yes/No, field.
Any help is appreciated.
Chuck

View 5 Replies View Related

Using LIMIT And UNION Together

Mar 19, 2008

hi,i have a union statement that works like a charm:SELECT
[Name],
[EventID] AS [ItemID],
[TourID],
[Date],
NULL AS [StartDate],
[Date] AS [SortDate],
[Type] FROM [Events]
WHERE
[TourID] IS NULL
AND
AccessLevel <= @AuthenticationLevel

UNION

SELECT
[Name],
[TourID] AS [ItemID],
[TourID],
NULL AS [Date],
[StartDate],
[StartDate] AS [SortDate],
'2' AS [Type]
FROM
[Tours]
WHERE
AccessLevel <= @AuthenticationLevel

ORDER BY
[SortDate]  this statement selects all the records i want from both tables, and orders the entire new table by sort date.what i want to do is to add a limitation on the number of records. i have tried using both LIMIT and TOP commands, but i can't get it working. both of the below statements give me a syntax error saying "Incorrect syntax near the keyword 'ORDER'"first try:SELECT * FROM (<same_statement_as_above>) ORDER BY [SortDate] LIMIT 2second try:SELECT TOP 2 * FROM (<same_statement_as_above>) ORDER BY [SortDate]what am i doing wrong, and how do i achieve what i want?i am working with mssql server 2005 (express locally, and standard on my hosting service). thanks for your help! 

View 2 Replies View Related

Connections Limit?

Dec 27, 2004

Hi,

I have an application with a DAL that has an interface with SQL Server.
The application has 400 users that open the web forms.
My question is:
Is there a limit of the parallel connections that can be opened? Or the IIS is managing all the access to the DB? Should I worry about the performance Or it's normal behaviour for ASP.NET applications?

Thanks

View 1 Replies View Related

Permission Limit

Jul 13, 2001

hello everybody
I created user "MyUser " with rights
1. public for database "Orders"
2. select, update,delete, insert to table Orders.dbo.PersonalInfo

I have table Orders.dbo.PersonalInfoChangeLog
( it keeps information on any update on Orders.dbo.PersonalInfo including
HOST_NAME())

So I don't want anybody to see even structure of this table(Orders.dbo.PersonalInfo ).

if person loged as "Myuser" he can use
1. sp_help PersonalInfoChangeLog
2.Enterpise Manager to see properties of the table

How can limit rights to see structure without generating Application role ?

Thanks

View 2 Replies View Related

How To Limit SQL&#39;s CPU Usage

Jul 31, 2001

SQL takes all CPU resource on some of the intensive
queries. Is any way to make sure there is something left for other tasks
to be processed? Let's say limit SQL to use no more than 80% of CPU.

Thanks

View 3 Replies View Related

Query Limit

Sep 17, 2001

I was wondering if anyone out there can help me as to how to limit the query results to show only the authors who have written more than one book?


SELECT a.au_lname, au_fname, COUNT(t.title_id)
FROM pubs..authors a
INNER JOIN pubs..titleauthor t ON (a.au_id=t.au_id)
GROUP BY a.au_lname, au_fname


Regards,

View 1 Replies View Related

Limit In Sql Server

Aug 3, 2004

someone suggested I use:

select top 20 * from t
where pkc not in (select top 10 pkc from t order by pkc) order by pkc

to simulate the limit function in mysql.

i want to replace the 10 in the inner select with a variable. When I do this:

select top 20 * from t
where pkc not in (select top @counter pkc from t order by pkc) order by pkc

it gives me in an error in sproc. Pls help!!

View 1 Replies View Related

Row Limit In MSSQL

Sep 8, 2004

There is at present (as we accidently found) limitation of MSSQL to return per row maximally 8060 bytes. Message like this comes: "Cannot create a row of size 8279 which is greater than the allowable maximum of 8060".
My questions are :
- Is there any way how to pass it? If I split into more tables (as I have it now) and ask for result where these tables are connected over any ID the result is the same. If I use stored procedures it seems to be ok. Any other idea?
- Will be this ok in SQL server 2005?

View 14 Replies View Related

Limit Record

Jan 29, 2005

hi everybody,

Beside top statement what is the best statement used to limit the display the data?

Thanks...

View 4 Replies View Related

Limit The No. Of Users

Apr 17, 2006

I have an application that uses a small SQL Server database.
What I need is to prevent the access of an amount of users to the database.
At the beginning I want to limit the access only for 2 users but I want to be able in the future to grant the access to more.

View 5 Replies View Related

Is There An MS SQL Limit Function?

May 13, 2006

MySQL has a convenient syntax for paging data that looks like this:
SELECT * FROM MyTable LIMIT 10, 20
That would select 10 records, starting from record 20, so that it returns records 20 - 30. This is convenient way to page data, without returning anymore rows than than you need.

However, MS SQL doesn't appear to support that syntax. What is the equivalent sql code to select any N rows from an arbitrary starting point, without having to create a stored procedure?

Thanks in advance :)

View 8 Replies View Related

MS SQL Record Limit

Apr 19, 2004

Quick question, is there a record limit in MSSQL assuming that we don't use a identity key. I am going to be using a table to sava mail server logs. It will create about 5000 records a minute. Also are there any perfomrance issues once you reach a certain numberof records, assuiming i am indexing one of the columns.

View 4 Replies View Related

Using LIMIT And UNION Together

Jul 22, 2013

I have a extremely large table and out of that I just need 2 records but based on some logic . For example

IF EMPLOYEE_ADDRESS <> NULL
set Employee_HAS_HOME to 1
ELSE
set Employee_HAS_HOME to 0

Here I can not use just first 1000 records as I am not sure If I will cover the second condition in first 1000 rows . Then I came up with solution like : -

select * from employee_table where employee_address <> NULL LIMIT 1
UNION
select * from employee_table where employee_address = NULL LIMIT 1

And this will give me 2 records which I can use for my testing . But unfortunately this is not working.

View 6 Replies View Related

How To Limit The Records..?

Jun 5, 2007

Hi,
I am working on building SSIS Packages which will need to extract records from OLTP Servers, and i am half way through building the package, i wanted to test if it is able to extract the records from a particular table on OLTP....basicall i want to test if the package built so far running good?....but the extraction part takes ages as there are millions of records in the OLTP ...i want to limit those records to say some thousands so that i can test it and work on cleaning part in the staging and later after all the chunks are working perfectly i want to set it completely to run for extracting all the millions of records.

Any suggestion would be appreciated.

thanks
ravi

Nothing much that i can do..!!

View 3 Replies View Related

Column Limit

Nov 14, 2007

I am working on a report split into 2 Excel spreadsheets because it is roughtly 350 columns wide. I know this exceeds the MS Access column limit, but is there a way to build this in a single table in SQL Server? If not, does anyone have any ideas.

Thanks

View 4 Replies View Related

Limit Problem

Nov 20, 2007

I have a table tblclients where all my client information is. In my application, I can assign a client to a therapist which is simply inserting the client id (intclientId) into the table with the inttherapistId and the authorid was completed the transaction. because we want to know the history of the transfers, I have to have a separate table other wise I could have just crated a field in the client table for the therapist id.

Simply enough.

The problem is when I assign the client to a therapist more than once, on the client log (the screen that shows all my clients) the client appears twice- once for each therapist he has been assigned to. I only want the client to appear once- and show the name of the latest therapist he has been assigned to not all the therapist. The way I did the select was to do an left outer join on the tbltransfer based on the client id. Works but like I said it gives me the client twice, if I assign them to the therapist more than once. So here is my statement:

select c.strfirstname, c.strlastname, c.intlocationId from tblclients c left outer tbltransfer t on t.intclientId = c.intclientId

this works, but if I have more than one record for the same client in the tbltranfer (if I assign the client more than once) then the recordset that is returned contains two records- one for each therapist assigned and that my problem.

Any help would be appreciated.

View 1 Replies View Related

Sql Server Limit

Jul 20, 2005

I'm storing time series data in a table in SQL server 2000. The tablehas columns like: CodeEquity, PriceDate, LastPrice. To extract thelast price for a number of equities on COMMON DATES I have used thequery:select t.LastPrice,h1.LastPrice,h2.LastPrice,h3.LastPrice fromBlg_HistoricData t,Blg_HistoricData h1,Blg_HistoricDatah2,Blg_HistoricData h3where t.CodeEquity=114151 and h1.CodeEquity=112220 andt.PriceDate=h1.PriceDate and h2.CodeEquity=112580 andt.PriceDate=h2.PriceDate and h3.CodeEquity=112228 andt.PriceDate=h3.PriceDatethis works for about 20 self joined tables and then says syntax error.I'm wondering what sql limits it hits. Is it possible to do this inSQL for 300 tables?Thank you.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved