Skip to content

How to verify SqlAlchemy engine object

I can declare engine object with the invalid username, password or address and get no exception or error: it prints likes it is a valid engine object: What would be a common way to verify (to check) if the engine object is valid or if it is “connectable” to db? Answer Question: How to verify if th…

Mysql Sum daily totals into weekly totals for given date range

Currently my db table has dailTotal values for every single day, I need to get these grouped into weekly totals. Is it possible to add the daily totals up into weekly totals and display a row each weekly total between the given date range. Im not quite sure where to start with this one. My current query to ge…

Using ‘LIKE’ and ‘REGEXP’ in a SQL query

I’m trying to use some regex on an expression where I have two conditions on the WHERE clause. The pattern I want to capture is 106 followed by any digit followed by a digit that must be either 3 or 4, i.e. 106[0-9][3-4] First, I tried this: This produced an error as below and it would be good to know

CONVERT issue in sqlserver with Msg 529 error

This statement is giving me a error VALUE column Datatype is TEXT in the RESULTS table. How can i overcome the above problem. please help ! Answer You can’t convert from text to datetime You must apply two convert operations. The first: From text to varchar The second: From varchar to datetime So your q…

SAS pass through query to SQL Server

I have some troubles with passing through query to SQL Server. OS is RedHat 6. In SAS Enterprise Guide I try to execute this code: but I faced with error: ERROR: CLI execute error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]INSERT failed because the following SET options have incorrect s…

How do I access a field of nested user defined types?

How do I access the fields of user defined types when they are nested ? When I tried it using dot notation it failed: For example, how do I “compile” this code ? Trying to run it: Answer Looks like a PL/PgSQL deficiency. In normal SQL you can do so with but pl/pgsql doesn’t accept the same f…