I have a procedure that has the following code: INSERT INTO DON_RECIP_RELATION (NUMBER, ID) SELECT DISTINCT (rec.NUMBER), cur_ID FROM REC rec, DON don WHERE don.NUMBER = rec.NUMBER …; …
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…
How to get datasource from Connectionstring using PowerShell?
In .Net we can get the datasource from a connectionstring using below mechanism: I was trying to do that in PowerShell but getting the following exception: New-Object : Exception calling “.ctor” with “1” argument(s): “Keyword not supported: ‘metadata’.” At line:…
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 to check if field value is same as combobox value?
So I am making a SQL query in which value of combobox (cboVU) shoud be same as field in table called Vrsta uredaja in table O klima uredaju. I am making this query in Access 2016. I am getting this: Tables and relations: Answer To continue on @Nathan_Sav’s comment:
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…
Display contact database by all categories it is marked, then alphabetical order
I’m trying to build a Vendor Contact Database with categories. Various vendors are marked under more than one category. I have structured my table as the following: My Current Code This is just a basic idea. My contact database has more fields including phone number, email, etc. Seeing how our category …