I have a not-that-large database that I’m trying to migrate to SQL Azure, about 1.6 gigs. I have the BACPAC file in blob storage, start the import, and then… nothing. It gets to 5% as far as the …
‘MOD’ is not a recognized built-in function name
I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message: ‘MOD’ is not a recognized built-in function name. Error: Msg 195, Level 15, State 10, Line 2 ‘MOD’ is not a recognized built-in function name. Why I can’t use this function from th…
A function calculating average age in years in SQL [postgresql]
I am trying to create a plpgsql function that calculates the average age (in years) of some persons with ids (integers) stored in another table. The code is: begin DROP TABLE if EXISTS dates; DROP …
How to change datatype of column with data
Let’s say I have a table call_log that has a column named duration. Let’s further pretend that when I put the table together, I made the mistake of making duration a varchar column instead of a number….
SQL Server: round decimal number and convert to int (within Select)
I am using the following line within a Select which returns a number with decimals, e.g. 33.33333. How can I round this within the Select and convert to integers so that I don’t have decimals, e.g. in the above example it should return 33 ? Answer You can use ROUND function to round the value to integer…
Query database tables for missing link
I have two tables in my database and they each share the a field called cID. So here’s an example: Parent Table _______________ cID Name — —— 1 Record #1 2 Record #2 3 Record #3 …
What is Impedance Mismatch?
What is “Impedance Mismatch” and how does it relate to databases?
Rails User.joins.not(…) in Active Record?
Im looking to query all Users without Comments in a single sql query? Models: class User < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :user ...
Is a query with table separated by comma a cross join query?
I know some of SQL but, I always use join, left, cross and so on, but in a query where the tables are separated by a comma. It’s looks like a cross join to me. But I don’t know how to test it (the …
Stored procedure to return count
I am trying to make a stored procedure for the query I have: or I have written this stored procedure but it returns count of all the records in column not the result of query plus I need to write stored procedure in plpgsql not in SQL. Help me write this type of stored procedure in plpgsql which returns retur…