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

mssql: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 4 ("@p2"): Data type 0xE7 has an invalid data length or metadata length. #32

Closed
bbigras opened this issue May 6, 2014 · 5 comments

Comments

@bbigras
Copy link
Contributor

bbigras commented May 6, 2014

I have the following error when I do :

_, err = tx.Exec("insert into tbl (fld) values (nullif(?, ''))", "")
mssql: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 4 ("@p2"): Data type 0xE7 has an invalid data length or metadata length.

I have a testcase.

@dimdin
Copy link
Collaborator

dimdin commented May 6, 2014

Hello @BrunoQC bit is mapped to bool, the parameter must be false or true.
What do you expect to do with an empty string?

@bbigras
Copy link
Contributor Author

bbigras commented May 6, 2014

I just fixed a typo in the commit.

I expect to insert a NULL when I have an empty string.

If my string is "0" or "1" it works as expected.

@dimdin
Copy link
Collaborator

dimdin commented May 6, 2014

A smaller test case is:

func TestEmptyStringParameter(t *testing.T) {
conn := open(t)
defer conn.Close()
rows, err := conn.Query("select ?", "")
if err != nil {
t.Fatal("Select with empty string failed")
}
rows.Close()
}

@bbigras
Copy link
Contributor Author

bbigras commented May 6, 2014

Yes this test case seems better.

In case you didn't know, here's how to use syntax highlighting on Github:

import "log"
import "log"

@dimdin
Copy link
Collaborator

dimdin commented May 6, 2014

thank you

dimdin added a commit that referenced this issue May 6, 2014
@dimdin dimdin closed this as completed May 6, 2014
odeke-em pushed a commit to orijtech/go-mssqldb that referenced this issue Jul 26, 2020
Adds sql-migrate as another alternative
odeke-em pushed a commit to orijtech/go-mssqldb that referenced this issue Jul 26, 2020
…a-withinstance

Minor tweaks to remove duplication
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