I am trying to use a table as input parameter for sp_execute_remote (Azure SQL Database). I declared the type on the remote db: I try to execute the script on my local db: I get an error on the 3rd EXEC statement: The underlying error message received was: ‘Operand type clash: int is incompatible with M…
Tag: sql
CASE WHEN with GROUP BY
I have the following query : I get this following error : Column ‘Status’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Answer
speed up the query which is taking 2 seconds on 1000000 on active records also on PostgreSQL Sql
I’m creating a dynamic query on the server side beside the parameter. However, my query is taking 2 seconds to fetch the records. I’m passing the query through active records let me share the query and Active record rails code SELECT (custom_attribute_values.attributable_id) FROM custom_attribute_…
Get rows of Last hour, Last ‘x’ minutes in SQL Server
Order ID Picker ID Time_Picked 1 111 2020-01-13 11:28:00 2 222 2020-01-13 11:40:00 3 333 2020-01-13 10:00:00 4 444 2020-01-13 9:00:00 5 555 2020-01-13 9:45:00 SELECT * FROM mytable WHERE …
SQL how to select a single value from a table with LEFT JOIN, In Google Datastudio
I have two tables one table called mailing_events and one table called mailing_outletcontact. Examples of my tables are below. The mailing table is very simple with no duplicates: My Second table “mailing_outletcontact” has duplicates in the email field. I am trying to query the database in Datast…
Can’t find MySql.Data.MySqlClient.MySqlException insert query error
This is the error message MySql.Data.MySqlClient.MySqlException: ‘You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 1′ this is my query I’ve been looking over at it for over an …
SQL query that has a lookup field
I have a table Invoices that has 3 fields: InvoiceProductCode InvoiceQuantity InvoicePrice InvoiceProductCode can be blank, but if it’s not blank, I would like it to be filled with a value from …
Create date in format YYYY-MM and add 0 in case month < 10
I want to create a date in the format YYYY-MM using postgresSQL. The month should always be two digits. For example if it is August 2020 the result should be 2020-08 and not 2020-8. Therefore, I …
1:N relationship to profile or user table?
Suppose I have a User Table and a UserProfile Table that I have separated. The two tables have a 1:1 relationship. User table contains only data like email and password, while UserProfile contains …
adding trimmed substrings
using sql server: I have a number of commands that trim a txt file, example: Case when charindex(‘-‘, Substring([RawStreamOut], 179, 10)) > 0 then ‘-‘ + Replace(LTrim(RTRIM(…