Username Remember Me?
Password   forgot password?
   
   
DB table creation
Posted: 29 November 2016 10:43 PM   [ Ignore ]  
Master
RankRankRank
Total Posts:  60
Joined  2010-05-27

Dear Developer,
I tried to use database function in the perclass.

In the following, I can create a table in the matlab if I put the function in only one line.
sdsql(DefLibDB, ‘create table exampledata( field1 varchar(20), field2 nchar(20), field3 int, field4 int, field6 int, field7 int, field8 int, field9 int, field10 int, field11 int, field12 int);’)

However, I want to create a table with over 100 fields. The fields so long, so I want the fields go to the second line or third line and used the following matlab supported notation (also see the attached file).

sdsql(DefLibDB, ‘create table exampledata( field1 varchar(20), field2 nchar(20), field3 int, field4 int,’…
‘ field6 int, field7 int, field8 int, field9 int, field10 int, field11 int, field12 int);’);

but, it does not seem to work.

any ideas?

thanks!

Image Attachments
PerClassIssue.PNG
Profile
 
 
Posted: 30 November 2016 02:15 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  365
Joined  2008-04-26

Dear Liwei,

I think that what is missing to be syntactically correct is the Matlab concatenation operator (square brackets) surrounding the string:

s=sdsql(db,['create table exampledata(field1 int, ' ... 
          
'field2 int);'...
    )

Does it help?

With Kind Regards,

Pavel

Profile
 
 
Posted: 30 November 2016 09:21 PM   [ Ignore ]   [ # 2 ]  
Master
RankRankRank
Total Posts:  60
Joined  2010-05-27

Thank you. it worked.

Profile