Showing posts with label user-defined. Show all posts
Showing posts with label user-defined. Show all posts

Friday, March 9, 2012

Defining your own Functions in XQuery

Hi Kent,
The Stylus team is right here - but maybe just a little more detail
will help.
DataDirect XQuery supports user-defined functions, and it works with
Microsoft SQL Server. Since Stylus uses the DataDirect XQuery
implementation to connect to databases from many vendors, the
limitations of the Microsoft XQuery implementation do not affect us.
Also, there are a *lot* of things that Microsoft SQL Server does not
support in XQuery. Our tutorials, like most XQuery tutorials, show let
clauses in FLWOR expressions, even though SQL Server does not support
it. The article you comment on is about XQuery, not about the
limitations of the Microsoft implementation, and there *are*
full-featured implementations of XQuery that work efficiently with
Microsoft databases.
JonathanHello jonathan.robie@.gmail.com,

> The Stylus team is right here - but maybe just a little more detail
> will help.
Sure, they are right that 3rd party products do support such features. But
they aren't helpful if and when they give users false expectations about
what SQL Server 2005 does natively. I don't think its so much to ask them
to help the community understand when they do postings like this, where that
technology and what SQL Server supports diverge.

> DataDirect XQuery supports user-defined functions, and it works with
> Microsoft SQL Server. Since Stylus uses the DataDirect XQuery
> implementation to connect to databases from many vendors, the
> limitations of the Microsoft XQuery implementation do not affect us.
Frankly, I'm glad a product like yours is on the market and I've long apprec
iated
the fact that Data Direct has refrained from this kind of "edu-adversting"
in this particular newsgroup so as to not muddy the waters. Well, until now,
but hey, I guess I encouraged you to say something at least. :)

> Also, there are a *lot* of things that Microsoft SQL Server does not
> support in XQuery. Our tutorials, like most XQuery tutorials, show let
> clauses in FLWOR expressions, even though SQL Server does not support
> it. The article you comment on is about XQuery, not about the
> limitations of the Microsoft implementation, and there *are*
> full-featured implementations of XQuery that work efficiently with
> Microsoft databases.
*Lot* sometimes feels like an understatement. And again, I don't have a prob
lem
with tutorials that XQuery specific. But what I do take exception to is simp
ly
dumping thinly veiled ads in this group, getting folks excited about somethi
ng
and then not being around to clean up the mess when that goes splat. Believi
ng
that an ounce of prevention is worth more than a ton of cure, is it really
asking too much for the Stylus Studio folks to help see good expecations
at the outset?
I'd hope not.
Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/

Friday, February 17, 2012

default value

How can i define a column with a variable default value
I know you can put a user-defined function
but i need to get the value from another table and UDF's cannot get data
from other tables? can they? i thought i read no select or update, and
they also cannot call stored procedures
Is there a way i can set a default for a column to be something along
the lines of ...goto table , update value + 1, grab new value and return
as default?Try a trigger. That's the only way I know where you can do what you are
proposing to do...
Aneesh.
"Chris M" wrote:

> How can i define a column with a variable default value
> I know you can put a user-defined function
> but i need to get the value from another table and UDF's cannot get data
> from other tables? can they? i thought i read no select or update, and
> they also cannot call stored procedures
> Is there a way i can set a default for a column to be something along
> the lines of ...goto table , update value + 1, grab new value and return
> as default?
>|||Aneesh Aravind wrote:
> Try a trigger. That's the only way I know where you can do what you are
> proposing to do...
> Aneesh.
> "Chris M" wrote:
>
I can't use a trigger because the column is defined as not null so it
has to have something in it before the trigger will fire. I tried to
put a -1 in it so that the trigger can fire but if i do that i cannot
insert multiple rows at the same time from a select because they all go
in with -1 and it has a unique contraint on it.
I am only trying to do this so that i can make two different database
systems work near the same way so i can leave the program calling them
untouched|||Why not to use IDENTITY property?
AMB
"Chris M" wrote:

> How can i define a column with a variable default value
> I know you can put a user-defined function
> but i need to get the value from another table and UDF's cannot get data
> from other tables? can they? i thought i read no select or update, and
> they also cannot call stored procedures
> Is there a way i can set a default for a column to be something along
> the lines of ...goto table , update value + 1, grab new value and return
> as default?
>|||Alejandro Mesa wrote:
> Why not to use IDENTITY property?
>
> AMB
> "Chris M" wrote:
>
I am trying to keep it as close to another database as i can. Its being
accessed by a delphi system that still uses the BDE. There is a bug in
the BDE that will not let you use autocreated numbers as ID fields so
you have to call a stored procedure prior to post to get the number.
That is working fine. I just need to have a backup in place for things
that are not entered from delphi/bde but from an sql insert or another
program accessing the database. Everything would work just dandy if
contraints were not enforced prior to the instead of trigger. That seems
to be the thing that keeps stopping me. And actually i'm not sure why
they are enforced prior to instead of since instead of can be used to
propogate some of them.|||Use an InsteadOf trigger rather than an After trigger.
Thomas
"Chris M" <chris@._takethisout_eventsoft.com> wrote in message
news:d490vv$glq@.dispatch.concentric.net...
> Aneesh Aravind wrote:
> I can't use a trigger because the column is defined as not null so it has
to
> have something in it before the trigger will fire. I tried to put a -1 in
it
> so that the trigger can fire but if i do that i cannot insert multiple row
s at
> the same time from a select because they all go in with -1 and it has a un
ique
> contraint on it.
> I am only trying to do this so that i can make two different database syst
ems
> work near the same way so i can leave the program calling them untouched