|
John, since I didn't see an answer to your question (and I was getting ready to automate a task in a similar fashion), I tried it out to make sure that I wasn't going to be wasting my time... and it works for me using RC1. What's the error you're getting?
Using the build file below, NAnt 0.85-rc1 and the Northwind database that ships with Sql Server 2k, I ran this command line:
nant -D:table=categories
and got the contents of the table output to stdout. You can see that I'm taking a param from the command line and catting it with another value into a new property and then executing the resulting property.
Here's the build file (I tried to be sure that we're using the same attributes/settings):
<?xml version="1.0" encoding="utf-8" ?> <project name="Restore.Database" default="restore" xmlns="http://nant.sf.net/release/0.85-rc1/nant.xsd"> <target name="restore"> <property name="sql" value="SELECT TOP 10 * FROM ${table}" /> <sql delimiter="," delimstyle="Normal" connstring="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;"> ${sql} </sql> </target> </project>
Here's the output.
NAnt 0.85 (Build 0.85.1793.0; rc1; 11/28/2004) Copyright (C) 2001-2004 Gerry Shaw http://nant.sourceforge.net
Buildfile: file:///C:/Projects/Prototypes/Database/RestoreDatabase.build Target(s) specified: restore
restore:
[sql] [sql] CategoryID CategoryName Description Picture [sql] ---------------------------------------------- [sql] 1, Beverages, Soft drinks, coffees, teas, beers, and ales, System.By te[] [sql] 2, Condiments, Sweet and savory sauces, relishes, spreads, and seaso nings, System.Byte[] [sql] 3, Confections, Desserts, candies, and sweet breads, System.Byte[] [sql] 4, Dairy Products, Cheeses, System.Byte[] [sql] 5, Grains/Cereals, Breads, crackers, pasta, and cereal, System.Byte[ ] [sql] 6, Meat/Poultry, Prepared meats, System.Byte[] [sql] 7, Produce, Dried fruit and bean curd, System.Byte[] [sql] 8, Seafood, Seaweed and fish, System.Byte[] [sql]
BUILD SUCCEEDED
Total time: 0.2 seconds.
> -----Original Message----- > Greets folks! > I"m a fairly new user to NAnt & NAnt Contrib (couple of weeks now). I > have a question regarding the <sql> task; I"m hoping this is the correct > place to ask (I didn"t see a "users" list). I have a sql statement > contained in a property. I want the <sql> task to execute that > statement (it"s build dynamicly). > > <sql connstring="Provider=SQLOLEDB;Data Source=(local);Initial > Catalog=eFinancials2_daily" delimiter="," delimstyle="Normal"> > ${versionUpdateSQL} > </sql> > > Doesn"t seem to do it, as I don"t believe the ${versionUpdateSQL} > property gets expanded. Any thoughts? > > Regards, > John W. Ellenberger > Senior Programmer/Analyst > Geac Commercial Systems Division |

