We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I tried to call a stored procedure like in your example but it doesn't work. Here is what I did on the SQL server:
SELECT @@version; Microsoft SQL Server 2019 (RTM-CU18) (KB5017593) - 15.0.4261.1 (X64) Sep 12 2022 15:07:06 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Linux (Oracle Linux Server 8.7) <X64> CREATE TABLE accounts1 ( id INT, account varchar(100) ); INSERT INTO accounts1 ( id, account ) VALUES( 122, 'Miller' ), ( 123, 'Smith' ), ( 124, 'Johnson' ); CREATE OR ALTER PROCEDURE [dbo].[sp_RunMe](@ID INT, @Account VARCHAR(100) OUTPUT) AS BEGIN SET NOCOUNT ON; SELECT account FROM accounts1 WHERE id = @ID END;
Here is my go code:
func main() { connectionString := fmt.Sprintf("user id=%s;password=%s;port=%s;database=%s", user, password, port, database) db, err := sql.Open("mssql", connectionString) if err != nil { fmt.Println(fmt.Errorf("error opening database: %v", err)) } defer db.Close() err = db.Ping() if err != nil { fmt.Println("Could not ping database!") } fmt.Println("Database was pinged") var account = "abc" _, err = db.ExecContext(ctx, "sp_RunMe", sql.Named("ID", 123), sql.Named("Account", sql.Out{Dest: &account}), ) fmt.Println(account)
If I try to run this I get this:
[tss@localhost mssql1]$ ./mssql1 Database was pinged abc
Is the Linux version of the SQL server not supported or am I doing something wrong? I'm grateful for every helpful hint.
Thank you
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I tried to call a stored procedure like in your example but it doesn't work.
Here is what I did on the SQL server:
Here is my go code:
If I try to run this I get this:
Is the Linux version of the SQL server not supported or am I doing something wrong?
I'm grateful for every helpful hint.
Thank you
The text was updated successfully, but these errors were encountered: