From: Nicolas on
Hi,

i'm currentlu using Matlab Database Toolbox to manipulate data in a SQL database.

My task is quite straightforward and still do I have conflicts. Here is the issue.

% I retrieve data from a Table Column (col3) and make it a cell A.
A = curs.Data(:,1)

% I manipulate the data e.g. multiply by a constant. That is, A_new, with the same dimensions.

% I try to update the table using fastinsert.
fastinsert(conn, 'database', col3, A_new)

NOW**
- is it true that i have to update all columns in that table e.g. col1, col2 and col3? because there will be zeros otherwise?
- my big problem is that i CANNOT update the column containing the primary key (col1)! neither with zeros nor with unmanipulated data.

- bottom line ... how can i update just one single column (col3) ? is that possible using fastinsert?

Thank you!!

Nicolas


-
From: Oleg Komarov on
"Nicolas " <misc.divers.misc(a)gmail.com> wrote in message <hm125t$aa0$1(a)fred.mathworks.com>...
> Hi,
>
> i'm currentlu using Matlab Database Toolbox to manipulate data in a SQL database.
>
> My task is quite straightforward and still do I have conflicts. Here is the issue.
>
> % I retrieve data from a Table Column (col3) and make it a cell A.
> A = curs.Data(:,1)
>
> % I manipulate the data e.g. multiply by a constant. That is, A_new, with the same dimensions.
>
> % I try to update the table using fastinsert.
> fastinsert(conn, 'database', col3, A_new)
>
> NOW**
> - is it true that i have to update all columns in that table e.g. col1, col2 and col3? because there will be zeros otherwise?
> - my big problem is that i CANNOT update the column containing the primary key (col1)! neither with zeros nor with unmanipulated data.
>
> - bottom line ... how can i update just one single column (col3) ? is that possible using fastinsert?
>
> Thank you!!
>
> Nicolas
>
>
> -

Use update if you want to update.

Oleg
From: Nicolas on
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hm14ck$3af$1(a)fred.mathworks.com>...
> "Nicolas " <misc.divers.misc(a)gmail.com> wrote in message <hm125t$aa0$1(a)fred.mathworks.com>...
> > Hi,
> >
> > i'm currentlu using Matlab Database Toolbox to manipulate data in a SQL database.
> >
> > My task is quite straightforward and still do I have conflicts. Here is the issue.
> >
> > % I retrieve data from a Table Column (col3) and make it a cell A.
> > A = curs.Data(:,1)
> >
> > % I manipulate the data e.g. multiply by a constant. That is, A_new, with the same dimensions.
> >
> > % I try to update the table using fastinsert.
> > fastinsert(conn, 'database', col3, A_new)
> >
> > NOW**
> > - is it true that i have to update all columns in that table e.g. col1, col2 and col3? because there will be zeros otherwise?
> > - my big problem is that i CANNOT update the column containing the primary key (col1)! neither with zeros nor with unmanipulated data.
> >
> > - bottom line ... how can i update just one single column (col3) ? is that possible using fastinsert?
> >
> > Thank you!!
> >
> > Nicolas
> >
> >
> > -
>
> Use update if you want to update.
>
> Oleg


i tried but then you need the where clause?

do you mean update in sql or update in matlab ?
From: Nicolas on
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hm14ck$3af$1(a)fred.mathworks.com>...
> "Nicolas " <misc.divers.misc(a)gmail.com> wrote in message <hm125t$aa0$1(a)fred.mathworks.com>...
> > Hi,
> >
> > i'm currentlu using Matlab Database Toolbox to manipulate data in a SQL database.
> >
> > My task is quite straightforward and still do I have conflicts. Here is the issue.
> >
> > % I retrieve data from a Table Column (col3) and make it a cell A.
> > A = curs.Data(:,1)
> >
> > % I manipulate the data e.g. multiply by a constant. That is, A_new, with the same dimensions.
> >
> > % I try to update the table using fastinsert.
> > fastinsert(conn, 'database', col3, A_new)
> >
> > NOW**
> > - is it true that i have to update all columns in that table e.g. col1, col2 and col3? because there will be zeros otherwise?
> > - my big problem is that i CANNOT update the column containing the primary key (col1)! neither with zeros nor with unmanipulated data.
> >
> > - bottom line ... how can i update just one single column (col3) ? is that possible using fastinsert?
> >
> > Thank you!!
> >
> > Nicolas
> >
> >
> > -
>
> Use update if you want to update.
>
> Oleg


i tried but then you need the where clause?

do you mean update in sql or update in matlab ?
From: Oleg Komarov on
"Nicolas " <misc.divers.misc(a)gmail.com> wrote in message <hm1j3a$rrc$1(a)fred.mathworks.com>...
> "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hm14ck$3af$1(a)fred.mathworks.com>...
> > "Nicolas " <misc.divers.misc(a)gmail.com> wrote in message <hm125t$aa0$1(a)fred.mathworks.com>...
> > > Hi,
> > >
> > > i'm currentlu using Matlab Database Toolbox to manipulate data in a SQL database.
> > >
> > > My task is quite straightforward and still do I have conflicts. Here is the issue.
> > >
> > > % I retrieve data from a Table Column (col3) and make it a cell A.
> > > A = curs.Data(:,1)
> > >
> > > % I manipulate the data e.g. multiply by a constant. That is, A_new, with the same dimensions.
> > >
> > > % I try to update the table using fastinsert.
> > > fastinsert(conn, 'database', col3, A_new)
> > >
> > > NOW**
> > > - is it true that i have to update all columns in that table e.g. col1, col2 and col3? because there will be zeros otherwise?
> > > - my big problem is that i CANNOT update the column containing the primary key (col1)! neither with zeros nor with unmanipulated data.
> > >
> > > - bottom line ... how can i update just one single column (col3) ? is that possible using fastinsert?
> > >
> > > Thank you!!
> > >
> > > Nicolas
> > >
> > >
> > > -
> >
> > Use update if you want to update.
> >
> > Oleg
>
>
> i tried but then you need the where clause?
>
> do you mean update in sql or update in matlab ?

It depends on what you need to accomplish, generally a where clause is needed in SQL.

I usually just download data from ms SQL and when I need to operate directly I just do it in SQL without going through matlab.

An insert as opposed to an update is a new record being added to the database...matlab "where" clause is simply used to build the actual sql statement.

Oleg