MATLAB is not passing string type variable into SQL SERVER 2014
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Usama Arshad
am 10 Mär. 2016
Kommentiert: Walter Roberson
am 12 Mär. 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Mär. 2016
query = sprintf( 'INSERT INTO table_Name (column_Name) VALUES (''%s'')', abc);
2 Kommentare
Walter Roberson
am 12 Mär. 2016
%s is a string format specifier for the sprintf() call. sprintf() is like fprintf() but returns the output to a string.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu String Parsing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!