Excel’s datetime values look like 42291.60493, which means MySQL sees them as strings and not as dates. Is there a MySQL code that can convert them to MySQL datetime? (i.e. like in MS SQL) Answer I can think of 2 solutions: Convert your dates within excel to a formatted date string that conforms to mysq…
Tag: sql
SQL Server – Deleting rows between a date range using SQL. Date conversion fails
This is the DELETE statement I wrote. There is an error that says: Conversion failed when converting date and/or time from character string. I know I have to write the correct date format, but I am not sure how that goes. This question has not been answered elsewhere because the answers I saw did not specify …
No error message displayed on MYSQL Workbench latest version
I am running the latest version of MYSQL Workbench on a clean ubuntu 14.04 install, using the ubuntu package version. When I run a valid query, it works fine, e.g.: select * from users; At the …
Assign Data to a User-Defined Table type from Select Query?
I have a stored procedure which retrieves three columns from multiple tables. I want to get the results in a user defined multi-valued table and pass the variable to another procedure to perform operations on the variable data. However it is not working. Any idea why it this not working? Answer The problem is…
How do identify the first character of a string as numeric or character in SQL
I need to identify the first character in my data as numeric or character in SQL Server. I am relatively new to this and I don’t know where to begin on this one. But here is what I have done to this point. I had data that looked like this: I used the right function to remove the ‘transfer fromR…
Why Can’t I Connect to My Database Over the Internet
I have an sql database called roottesting and I manage it at the ip 192.168.1.121. I also have a simple java application that connects to it (or rather, is supposed to connect to it) over the Internet with a user named ‘user’ that has a host of ‘%’, which I know will make it usable for…
How to select from User Defined Table Type?
The above query returns me data but when I try to query the data within, it says dbo.udt_test not exists? https://msdn.microsoft.com/en-us/library/ms131086.aspx Referred to the above link, there should be no problem with the select query to display data. May I know if I missing something obvious here? Answer …
How to set to NULL a datetime with 0000-00-00 00:00:00 value?
I need to change a few values on my DB. I forgot to set nullable to the table and it set to 0000-00-00 00:00:00 by default. Now I need to convert that value in NULL. The field type is Datetime. How can I do it? I try with the typical Update table set field = NULL WHERE field = ‘0000-00-00
How to iterate over results of query
I am creating a function in pgsql script language, and what I want to do in this point is iterate over the results of a query and for each row do something specific. My current try is the following, where temprow is declared as temprow user_data.users%rowtype. The code in question is the following: However I …
Running Oracle SQL query over several dates
Within Crystal Reports, I’m using the following query (against an Oracle database) to generate data for a single field in a report: This works fine and returns a single integer value, based on the {?HB_As_At_Date} supplied (The {?} syntax is Crystal’s way of embedding parameter values into SQL). T…