SQL Server parameter placeholder

Hey guys. According to the information below, each database engine has its own placeholder for parameters. What about the SQL Server’s?

Appreciate any help, tnx…

Hi Leo. What driver are you using? Usualy the driver doc’s have some example on how to pass parameters.
The denisenkom / go-mssqldb driver has an example in their readme.
Link to the readme: https://github.com/denisenkom/go-mssqldb#statement-parameters

Fala mano, eu sou do Brasil também, mas vou continuar a comunicação em inglês que é pra ficar de referência pra quem possa talvez um dia passar pela mesma situação.

I’m using an odbc driver named “alexbrainman/odbc”, this driver you have mentioned in your reply, does not work, it connects to database, gives no error, when I open any select query, it brings me a resultset with exactly the number of rows it’s expected, but everything with NULL values.

Tnx & best regards,

Bom ver pessoal do brasil aqui hehe. Mas é melhor continuar em inglês mesmo, para referencia como você disse.

I don’t have access to a windows machine so I cannot test anything. But after some digging I saw the driver that you are using relies upon on the odbc32.dll.
In the microsoft docs there is some reference about the “SQLBindParameter” method. In this docs the example C code show the parameters as question marks.

retcode = SQLPrepare(hstmt, (SQLCHAR*)"INSERT INTO Orders(CustomerID, EmployeeID, OrderDate) VALUES (?, ?, ?)", SQL_NTS);

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.