Wrox Programmer Forums
|
BOOK: Beginning SQL Server 2005 Programming ISBN: 978-0-7645-8433-6
This is the forum to discuss the Wrox book Beginning SQL Server 2005 Programming by Robert Vieira; ISBN: 9780764584336
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning SQL Server 2005 Programming ISBN: 978-0-7645-8433-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2006, 04:16 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Predicate syntax?

I do not see where the book explains the syntax of predicates, yet they are critical for even simple databases, appearing in SELECT/DELETE/UPDATE WHERE, GROUP BY HAVING, and ADD CONSTRAINT clauses. There does not seem to be any explanation of AND, OR, NOT, IS NULL, parentheses or operators. For example, validating Day for the INT columns Day, Month, Year takes this predicate:

Day IS NULL OR Day BETWEEN 1 AND 28
 OR Day BETWEEN 29 AND 31 AND Month IN(1, 3, 5, 7, 8, 10, 12)
 OR Day BETWEEN 29 AND 30 AND Month IN(4, 6, 9, 11)
 Day = 29 AND Month = 2 AND Year % 4 = 0 AND (Year % 100 != 0 OR Year = 2000)

Readers also ought not to be surprised when on retrieval this predicate comes back from SQL Server 2005 as:

([Day] IS NULL OR [Day]>=(1) AND [Day]<=(28) OR [Day]>=(29) AND [Day]<=(31) AND ([Month]=(12) OR [Month]=(10) OR [Month]=(8) OR [Month]=(7) OR [Month]=(5) OR [Month]=(3) OR [Month]=(1)) OR [Day]>=(29) AND [Day]<=(30) AND ([Month]=(11) OR [Month]=(9) OR [Month]=(6) OR [Month]=(4)) OR [Day]=(29) AND [Month]=(2) AND [Year]%(4)=(0) AND ([Year]%(100)<>(0) OR [Year]=(2000)))





Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex predicate question dcheslow XSLT 4 February 25th, 2007 02:21 PM
Selecting data using axis in predicate Chamkaur XSLT 1 July 9th, 2006 01:02 PM
A problem with predicate in XSLT1.0:( sureshk XSLT 1 March 8th, 2006 01:13 PM
Predicate question pdamer XSLT 3 November 19th, 2003 11:30 AM
Predicate not being checked properly JeanFrancois XSLT 2 June 16th, 2003 09:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.