Showing posts with label case. Show all posts
Showing posts with label case. Show all posts

Monday, March 26, 2012

Making Excel Source case insensitive

Hi:

When I import data from multiple excel files, the Excel source gives validation errors if the case of a column name changes.

How can I make my excel source Case Insensitive?

TIA

Kar

I don't know of any way to do this, but it should be possible to "pre-process" the Excel spreadsheet to LOWER() the column names before running the data flow by using the Script task and the Excel object model.|||

Well, I could do that, but I hoped there was an extended property or something to set the Engine to Case-insensitive mode.

Anyways, I have a workaround. Use a SQL Query or a SQL Query from variable, and the case that you have in the query will hold for the rest of the dataflow, no matter what the source excel contains in its first row.

Thanx

Kar

|||If there is, I'm unaware of it. I'll bow out and we can see what others have to say. Good luck!

Wednesday, March 21, 2012

make XML column not case sensitive

Is there any way that an xml column in sql can be made to not be case sensitive?

So you can search for the text() of a node matching say 'open' (properties.exist('property[. = "open"]') and get all results back where the property text = "OPEN" or any other not case sensitive combination of "open".

Collations are not supported in SQL Server 2005 for XQuery. In order to perform your collation-sensitive comparison, you should promote the value out of the XML instance using the .value() method and perform the comparison in T-SQL.
|||

If you find that you like to see such functionality added in a future release, please file a request in the SQL Server Feedback Center @. http://lab.msdn.microsoft.com/productfeedback/

Best regards
Michael

sql

Monday, March 19, 2012

Make SQL Queries Case Sensitive

Hi,

I have an SQL Server 2000 database. There is a table for User Logins. I want the query to be executed as case sensitive. I mean if the database has a username like "USER1" and the user enters his username as "user1" then the login should fail.

So, Is there some way I can make SQL case sensitive? Please help

Regards

Vineed

This is a collation issue. Assuming your table name is UserTable and the field that holds username is UserName (varchar(50)), you can alter your table as follows:

Code Snippet

Alter Table UserTable Alter Column UserName (varchar(50) collate latin1_general_CS_AS)

If you want case insensitive, change CS to CI.

|||

Hi,

Thanks for your time. Really helped.

Thanks again

Regards

Vineed

Make Sql Function to modify data like Sql Procedure to improve code structure and readability.

Now Sql Function can not modify data as Sql Procedure like other database, it's very troublesome at most case!

in most case, Sql Function is used to improve code structure then it can be maintanced easy! BUT only because it can not modify data, there are 2 troublesome way:

1. Make all callers in the path from Sql Functions to Sql Procedure. and the coder will cry, the code will become very

confusional , and very difficult to maintance.

2. Divide the Sql Function into a thin CLR wrapper to call a Sql Procedure, can only use another connection, BUT can not be in the same transaction context And the code is ugly and slow.

You should not give limitation to Sql Function, should just limit the using context of Sql Function!

The sql code is more difficult to read and maintance than norm code(C#), then the improving code structure and readability should be one of your most important task, that's why microsoft!

I won’t agree with your point here.

1. Code structure and readability might vary person to person. If you are a C# programmer you might find the SQL programming looks difficult, the same db programmer sees the C# code.

2. The programming languages or script languages are not considered “How your code structured and readability” they only about how efficiently you can code. The simple lines of code need not to be efficient than the huge lines of code. Readability and structuring the code is up to the coder/programmer. It is not one of the consideration on compiler or language to choose.

Function Restriction:

These are used to limit the boundary, and allow the users to experience good performance in any kind of scenario. All the languages has its own boundary and limitations.

SQL Server never allows a Insert/Update/Delete statements inside your function (on your DB objects). Its makes sense, because functions are different from sps. SPs are the batches which will be invoked from the single point (using Exec…). But function are called from your SQL statements (like Insert/Update/Delete/Select). Lets say when you try to call the select statement why you want to do any data medication on your database tables. It is controversial with accepted SQL behavior.

Finally the Code readable & structured is upto you (who creates) & who read the code. It is widly accepted behavior in the database(take any database).

|||

Hi!

Do you mean it should work like functions in PL/SQL ;^)

/Bjorn

|||

Hi,

Manivannan.D.Sekaran, I do not think you are right. Bjorn is right!

If you have use DB2 and Oracle, or you have writen much more complex sql code, you will not say it like so. you can not say: I do design it like so because it may cause low performance, even if it can not complete some common task. you should has task like that! I do not think let sql Function update data will cause low performance in most case. if it's true, how do DB2 and Oracle live?

User's requirement is the most important thing! all other is under it.

|||

I agree. In PL-SQL you can't have SELECT statements inside your SP. If you Select you have to supply the INTO clause rite? But in SQL Server you can create a wrapper for (even) your select statement(s).

I am not here to argue whether SQL Server is best or Oracle is not, I am just wanted to explain the approach how it will affect your performance when you want to do data manipulation on Functions. Bcs every database engine has its own behaviour....

Why SQL Server missed might be big Qs?

But To fix this limitaion we have the .NET integration now (you have work-around).

|||

Hi, i agree, every database engine has its owner behaviour! and every database has it's advantage over others, BUT, i think the advantage of sqlserver is easy to use! yes, i have work-around, but you think the work-around is satisfactorily? On the one hand, it add complexity, i have to write a thin wrapper just for this, on the other hand, i can not use the same transaction context, this will cause error at some case. the last it will slow down!!!

just now , you said "Lets say when you try to call the select statement why you want to do any data medication on your database tables", then I give a example to use sql function:

I hava a complex calculate on amount of entries which depend on volatile data, in order to improve perfomanace, the best way is to add cache, and use lazy calculation. if sql function support modify data( add to the cache if not there) , everything is simple. Now, it's not there, many sp and function use this cache has to be rewrited, in my system, there are handrens sp and function use this "base function", now you know what the task is. i have to change all function to sp, and add some sp_PrepareXXX + fn_GetXXX, it's very troublesome!!! and the whole consitent code was changed to very urgly code!

Another if i use founction first and wirte thousands sql function and sp depend on it, but later i want to change the implementation to provide some lazy algorithm(has to update data) to improve performance, what i can do is cry! BUT this will not happen in norm coding(e,g, C#).

To user's view, should not has sp exists, the function is enought, although every database has it's limitation,BUT this is the final goal of computer industry, is it? I do think microsoft will do much better job then us if they do it in database system level--both in performance or in syntax, although it may has some shortcoming, it should give a way to handle complex case.

thanks for u reply, just for technology.

|||

Hi Manivannan!

I would become really happy if MS extend the (T)SQL language,

providing the feature of functions we are talking about here.

It would also be very nice if you support TSQL-packages, ANSI-XML-features in SQL

and naming overloading.

/Bjorn

Make MS SQL Server case-sensitive

I have already install my Microsoft SQL server 2000 as not case
sensitive, how to I change it to be case sensitive?Hi

Check out this previous post

http://tinyurl.com/2qzrv

John

"Dean" <deantakamine@.hotmail.com> wrote in message
news:4563939b.0401091713.3b12169@.posting.google.co m...
> I have already install my Microsoft SQL server 2000 as not case
> sensitive, how to I change it to be case sensitive?|||deantakamine@.hotmail.com (Dean) wrote in message news:<4563939b.0401091713.3b12169@.posting.google.com>...
> I have already install my Microsoft SQL server 2000 as not case
> sensitive, how to I change it to be case sensitive?

Information is in SQL Server books online.

The index is 'case-sensitive instance of SQL Server'.

However, most people are used to the default (case insensitive).