it is quite simple if you want to limit the number of records return from the query execution in SQL Server
Select top N Rows from your table..
However DB2 did not support the select Top N Rows, there is a work around function
like this
Select * from your table order by column Desc fetch first N rows only
since the fetch first N rows only will return random number of rows. we must use order by column name to enforece the same records return by sorting the column.
a blog to share Microsoft technologies Azure, DotNet, SharePoint, SQL Server,JavaScript Framework: Node.JS, Angular, React
Showing posts with label DB2. Show all posts
Showing posts with label DB2. Show all posts
Tuesday, January 24, 2017
Wednesday, March 20, 2013
How to solve Case Insensitive Issue in DB2 Query
we all know that SQL Server are case insensitive. when we implement the stored procedure, we did not worry about the filter criteria in the where clause.
I encounter an very strange error that use must use the correct format criteria when they run the application to search the database. the root cause of this issue is DB2 is case insensitive by default.
here is a work around to solve this issue. we can convert the filter column value to either upper case or lower case.
Select column1, column2 from DB2 Table
Where Upper(column1)=Upper(criteria one) and Lower(column2)=Lower(Criteria)
after I use the upper and lower function to convert the column values and filtered value in the stored procedure. now My Search application will ignore the case sensitive in the search input.
I encounter an very strange error that use must use the correct format criteria when they run the application to search the database. the root cause of this issue is DB2 is case insensitive by default.
here is a work around to solve this issue. we can convert the filter column value to either upper case or lower case.
Select column1, column2 from DB2 Table
Where Upper(column1)=Upper(criteria one) and Lower(column2)=Lower(Criteria)
after I use the upper and lower function to convert the column values and filtered value in the stored procedure. now My Search application will ignore the case sensitive in the search input.
Subscribe to:
Posts (Atom)