Tag: mysql

Needed help to converting mssql functions into mysql

Could anyone help me to solve issues with converting MsSQL to MySQL? It gives a syntax error. Original Mssql function: CREATE FUNCTION StrToNum (srt1 varchar(250)) RETURNS real AS BEGIN DECLARE t real IF srt1 IS NOT NULL and ISNUMERIC(srt1)=1 and PATINDEX(‘%,%’,srt1)=0 and PATINDEX(‘%e%’,srt1)=0 SET t=CONVERT(Money,srt1) ELSE SET t=NULL RETURN t END i tried like this […]

SQL Select Data with condition on multiple rows

Suppose that I have a table called “tblTemp” with the following data ID Name 1 A 2 B 3 C 4 A 4 B 5 A 5 B 5 C 6 C 6 B I want to get ID from name of A&B only not A&B&C like below: 4 A or 4 B How can […]

Correlating log entries, such as failed login attempts efficiently

I am looking for an efficient way to identify account brute forcing. My log database contains authentication log entries. Each entry has: time stamp username IP address login attempt results (success / fail ) I want to produce a report which indicates that which logins have been attacked. Attacked is defined as: unsuccessful login attempts […]

MySQL – sql server: consistency check

I’m trying to check the results of a data load between two databases. Unfortunately, I only have access to one database (MySQL) directly, the company managing MSSQL can expose it to us via an API. What I would like to do is check the consistency of certain columns across rowsets. Originally, I had hoped to […]

some queries regarding updates/inserts rate limits for a database(SQL-based or NoSQL based)

In an app, I need to update a large number of records/insert a large number of records near-simultaneously into a database. Is there any such insert/update limit which will act as a bottleneck for my app? Is there something I can do to maximise the insert/update rates. Also, regarding the updates, the same record will […]

PHP+MYSQL need to be used alongside ASPX+MSSQL on same Windows server

My site registers users through an ASPX form and MSSQL. I need to run an app in PHP+MYSQL parallel for the same set of users. So: I need to transfer user registration data from MSSQL, which is the entry point for users, to the MYSQL table. While browsing the site, the session should be transferred […]

pulling data from MySql Server using SQL server openquery

I am trying to pull data from Mysql server using SQL server OPENQUERY function. When I run a query to count the records that are in thew mysql server I get the value no problem -this query works and it return the total records found SELECT count(*) AS total FROM OPENQUERY(LinkedServer, ‘SELECT * FROM mydb_name.users’) […]

Find the company that has the smallest payroll

Hi i have the following database scheema. employee (employee-name, street, city) works (employee-name, company-name, salary) company (company-name, city) manages (employee-name, manager-name) I need to find Find the company that has the smallest payroll. I have written the following query but my trainer tells me its wrong. SELECT company-name FROM works GROUP BY company-name HAVING sum(salary) […]

Dynamic SQL = 42000 – Incorrect syntax near '01'

Here is my code: DECLARE @1day AS VARCHAR(MAX), @sqlText AS NVARCHAR(MAX), @firstdate AS DATETIME SET @firstdate = DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()) SET @1day = CONVERT(VARCHAR(MAX), @firstdate, 103) SET @sqlText = ‘SELECT ‘ + ‘Dummy’ + ‘ AS ‘ + @1day EXEC (@sqlText) I am getting the error: [Err] 42000 – [SQL Server]Incorrect syntax near ’01’. Expected result is: […]

get field in a single row from union query

I have written a query that retrieve result from union. But it shows the result in two row and leave the blank column with 0. But I need the result in one row and no need the zeros. Can anyone please help me on this. Here are my query given below which I have written […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.