The SELECT permission was denied on the object ‘Users’, database ‘XXX’, schema ‘dbo’

I think the problem is with the user having deny privileges. This error comes when the user which you have created does not have the sufficient privileges to access your tables in the database. Do grant the privilege to the user in order to get what you want. GRANT the user specific permissions such as SELECT, INSERT, … Read more

How do I fix ‘Invalid character value for cast specification’ on a date column in flat file?

I was ultimately able to resolve the solution by setting the column type in the flat file connection to be of type “database date [DT_DBDATE]” Apparently the differences between these date formats are as follow: DT_DATE A date structure that consists of year, month, day, and hour. DT_DBDATE A date structure that consists of year, … Read more

ClassNotFoundException – com.microsoft.jdbc.sqlserver.SQLServerDriver

I have a web development project using local install of Tomcat 7. I am trying to connect to SQL Server 2012 using Microsoft’s driver for jdbc (sqljdbc41.jar). The sqljdbc41.jar is in my application build path: and I am exporting it. Furthermore, in the Tomcat application directory lib folder I have also placed a copy of … Read more

Arithmetic overflow error converting expression to data type datetime. (while displaying date time..)

You issue is that you’re trying to convert the numeric to a datetime, and this just isn’t working. You need to turn your numeric into a string first: SQL Fiddle with demo. When you try and convert a numeric type to a datetime, SQL Server tries to add the numeric value as the number of days to the date 01-Jan-1900. In your … Read more

How to convert SQL Server’s timestamp column to datetime format

SQL Server’s TIMESTAMP datatype has nothing to do with a date and time! It’s just a hexadecimal representation of a consecutive 8 byte integer – it’s only good for making sure a row hasn’t change since it’s been read. You can read off the hexadecimal integer or if you want a BIGINT. As an example: The result is In newer … Read more

Is there a combination of “LIKE” and “IN” in SQL?

There is no combination of LIKE & IN in SQL, much less in TSQL (SQL Server) or PLSQL (Oracle). Part of the reason for that is because Full Text Search (FTS) is the recommended alternative. Both Oracle and SQL Server FTS implementations support the CONTAINS keyword, but the syntax is still slightly different: Oracle: SQL … Read more