Can MySQL convert a stored UTC time to local time-zoned time directly in a normal select statement? Let’s say you have some data with a timestamp (UTC). CREATE TABLE `SomeDateTable` ( `id` int(11)…
Help finding old SQL tool that rewrote queries [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 7 years ago. Improve this question There was this old sql server tool called Lectoneth or something like that, you’d put sql queries in it, and it would rewrite it
Check if role exists in DB?
I want to add users to the same role in more than one database. However the role may or may not be present in each database. How can I check if the role exists in each database and if it does, add users to that role? e.g. IF role exists BEGIN Add user in role END Answer try:
SQL method to replace repeating blanks with single blanks
Is there a more elegant way of doing this. I want to replace repeating blanks with single blanks…. (its sql server 2000 – but I would prefer generic SQL) Answer Here is a simple set based way that will collapse multiple spaces into a single space by applying three replaces. Your Update statement can now be set based: Use an
SQLite equivalent of PostgreSQL’s GREATEST function
PostgreSQL has a useful function called GREATEST. It returns the largest value of those passed to it as documented here. Is there any equivalent in SQLite? As a note, I only need it to work with 2 …
Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’
I am using WinHost.com to host my site. The SQL Database/membership system works perfectly on my local computer, but when uploaded to the server it doesn’t work. I’ve followed all steps correctly. And …
generate days from date range
I would like to run a query like select … as days where `date` is between ‘2010-01-20’ and ‘2010-01-24’ And return data like: days ———- 2010-01-20 2010-01-21 2010-01-22 2010-01-23 2010-01-…
Inner Join two tables when one column is a text and the other is number
I have a program in access that is using some linked ODBC tables. I had originally had a query that contained the following INNER JOIN: This worked just fine until the column Neptune_prem.premice_id got changed from a number to a text data type. So now I need a way to use an INNER JOIN on two columns when one is
How to verify if two tables have exactly the same data?
Basically, we have one table (original table) and it is backed up into another table (backup table); thus the two tables have exactly the same schema. In the beginning, both tables (original table and backup table) contains exactly the same set of data. After some time for some reason, I need to verify whether dataset in the original table has
Finding duplicate rows in SQL Server
I have a SQL Server database of organizations, and there are many duplicate rows. I want to run a select statement to grab all of these and the amount of dupes, but also return the ids that are associated with each organization. A statement like: Will return something like But I’d also like to grab the IDs of them. Is