Tuesday, January 21, 2025
HomeGolangdb.Exec Insert with a the place not exists clause - Getting Assist

db.Exec Insert with a the place not exists clause – Getting Assist


This assertion works so I do know my connection string and so on is sweet:

consequence, err = db.Exec(“INSERT INTO [dbo].[Priority] ([Priority_SHA256]) VALUES ($1), string(cfg.Basic.PrioritySHA256[:]))

However once I add the WHERE NOT EXISTS clause, I can’t work out methods to substitute the worth ( see the daring portion within the following:

consequence, err = db.Exec(“INSERT INTO [dbo].[Priority] ([Priority_SHA256]) VALUES ($1) WHERE NOT EXISTS ( SELECT ‘x’ FROM [dbo].[Priority] WHERE [Priority_SHA256] = string(cfg.Basic.PrioritySHA256[:]))”, string(cfg.Basic.PrioritySHA256[:]))

Connecting to a sqlserver db

Did you imply:

INSERT INTO [dbo].[Priority] ([Priority_SHA256]) VALUES ($1) WHERE NOT EXISTS ( SELECT ‘x’ FROM [dbo].[Priority] WHERE [Priority_SHA256] = $1)

I did and tried that however it complains when it will get to the primary “WHERE”

Error:(16, 556) anticipated, bought ‘WHERE’

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments