MATLAB is not passing string type variable into SQL SERVER 2014
31 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Usama Arshad
il 10 Mar 2016
Commentato: Walter Roberson
il 12 Mar 2016
abc = 'abcdef';
conn = database('databasename','user id','password',...
'Vendor','Microsoft SQLServer', 'Server', '(local)', 'AuthType', 'Server', 'portnumber', 1433);
query = 'INSERT INTO table_Name (column_Name) VALUES (abc)';
curs = exec(conn,query );
close(curs);
close(conn);
0 Commenti
Risposta accettata
Walter Roberson
il 10 Mar 2016
query = sprintf( 'INSERT INTO table_Name (column_Name) VALUES (''%s'')', abc);
2 Commenti
Walter Roberson
il 12 Mar 2016
%s is a string format specifier for the sprintf() call. sprintf() is like fprintf() but returns the output to a string.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su String Parsing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!