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

Return the number of row affected #147

Open
SkeletonGamer opened this issue May 14, 2019 · 2 comments
Open

Return the number of row affected #147

SkeletonGamer opened this issue May 14, 2019 · 2 comments

Comments

@SkeletonGamer
Copy link

SkeletonGamer commented May 14, 2019

Hi @nuintun, I want to know how to get the number of rows affected after an UPDATE or DELETE.

I tested with scalar but thrown an error -2147217900.

const data = await connection.execute(sql, 'SELECT @@ROWCOUNT');

Thanks for help :)

@nuintun
Copy link
Owner

nuintun commented May 17, 2019

Try SELECT @@Identity ?

@SkeletonGamer
Copy link
Author

SELECT @@Identity returns the last INSERT id. With UPDATE and DELETE, it is returning 0. 😞

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