Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NamedExec query does not work with sql server. #374

Closed
vishal8492 opened this issue Dec 19, 2017 · 2 comments
Closed

NamedExec query does not work with sql server. #374

vishal8492 opened this issue Dec 19, 2017 · 2 comments

Comments

@vishal8492
Copy link

README example with NamedExec query does not work with sql-server.

I'm using mssqldb driver. (github.com/denisenkom/go-mssqldb)

MustExec returns following error :
Err : result : mssql: Incorrect syntax near '?'.

@vishal8492
Copy link
Author

vishal8492 commented Dec 19, 2017

This is because of while compiling query all args are appended with '?' because bindtype is unknown, we should just use @p{increment} there?

@jmoiron What do you think should I add bindtype for sqlserver?

Also, MustExec does fail for sql-server as well may be we convert $1, $2 to @p1,@p2 based on bindtype ?

@ninlil
Copy link

ninlil commented Apr 9, 2018

This is rather urgent as the denisenkom/go-mssqldb-driver seems to deprecate the "mssql"-driver and encourage the "sqldriver" with named parameters.

I absolutely love the Select and Get with built-in mapping/scanning and would love to get that with named params.

Edit: Using the "@p1" instead of "$1" works just fine, so it's not a critical issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants