Re: how to assign the contents of a field to a variable
From: Robin Boyd (none_at_nowhere.com)
Date: 07/14/04
- Next message: Satya SKJ: "RE: DTS permissions?"
- Previous message: Tom Moreau: "Re: surely, there's got to be a better way"
- In reply to: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Next in thread: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Reply: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 14 Jul 2004 17:02:20 +0200
Hi,
I need to exoprt alL the fields that have been modifed to the XML document,
I was going to compare the fields in the "inserted" table with fields in the
"deleted" table (for updates), and then only export the fields that had been
modified. The project is on hold now, so at least Im not loosing any sleep
over how to get the values of the fields into variables!
This is simple to do if I hard code each field and the structure of the
table does not change, as this is an implentation for a customer, I wanted
to 'future-proof' the solution.
I still think there must be some way to accomplish this, allmost every other
DBS system I've used ables you to do this is some form, the easiest I have
ever seen was in Foxpro (V 2.6) "scatter memvar" :)
If anyone has any ideas on this I'd still be pleased to have them!
Thanks all
Robin Boyd
"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:u3u63CaaEHA.712@TK2MSFTNGP11.phx.gbl...
> I think Mischa covered it well. BTW, performance is not something you
think
> about "later". It must be a fundamental part of your deisgn.
>
> BTW, I'm more curious about the requirement. it appear you loop through
> each column of each updated row. Is there a technical reason for that?
>
> --
> Tom
> -------------------------------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinnaclepublishing.com/sql
>
> "Robin Boyd" <none@nowhere.com> wrote in message
> news:cd2lan$ot8$1@ork.noris.net...
> Hi Mischa,
>
> that hurts, I think a new strategy is required, I really don't like the
idea
> of a large code block in the execute statemant!
>
> Thanks for your input.
>
> Robin
>
> "Mischa Sandberg" <mischa_sandberg@telus.net> wrote in message
> news:lo1Jc.43491$Rf.12075@edtnps84...
> > :-) Two non-obvious things going wrong here.
> >
> > (1) You meant EXEC(@MySQL), not EXEC @MySQL.
> > The first does what you want. The second tries to find a STORED PROC
with
> > the unlikely name of "SELECT @CurrFieldValue = ...".
> > Hence the 'not valid identifier' error.
> >
> > (2) Inside and outside EXECUTE(...) are two different scopes.
> > That means, the @CurrFieldValue you declared in the surround code
(proc?)
> > does not exist, as far as the code inside the EXECUTE() string is
> concerned.
> > And, if you declared (and set) @CurrFieldValue in the string, that would
> > have
> > no effect on the one declared outside the EXECUTE().
> >
> > What this means is, you may have to move a hunk more code into the
EXEC()
> > string.
> >
> >
> > "Robin Boyd" <none@nowhere.com> wrote in message
> > news:cd0rpp$1ni$1@ork.noris.net...
> > > Hi all,
> > >
> > > I am trying to assing the value of a field (stored in a variable) to
> > another
> > > variable. I have tried various approaches with no success :(
> > >
> > > here is the code I am working with...
> > >
> > > --SELECT@CurrFieldValue = CustomerID FROM[Inserted]
> > > SET @MySQL = 'SELECT @CurrFieldValue = ' + @CurrFieldName + ' FROM
> > > [Inserted]'
> > > EXECUTE @MySQL
> > >
> > >
> > > I currently get the following error message:
> > > The name 'SELECT @CurrFieldValue = CustomerID FROM [Inserted]' is not
a
> > > valid identifier.
> > >
> > > The commented lien works perfectly, however as I execute this code
from
> > > within a loop (for all the fields in the table) this is no good.
> > >
> > > Any help, pointers or such, most welcome!
> > >
> > > Thanks in advance,
> > > Robin Boyd
> > >
> > >
> >
> >
>
>
>
- Next message: Satya SKJ: "RE: DTS permissions?"
- Previous message: Tom Moreau: "Re: surely, there's got to be a better way"
- In reply to: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Next in thread: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Reply: Tom Moreau: "Re: how to assign the contents of a field to a variable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|