SQL Query in Lua Script returning a null value

Discussion created by support-atisw on Oct 10, 2009
Latest reply on Oct 10, 2009 by support-atisw
I ran the following SQL statement from the Service Level Manager and it returned the value I was expecting.  However, when I run the same in a Lua script, I get a null value.  Below is my Lua code.  For some reason, the first index of the results of my query is a table so I have to set my table equal to the first index before trying to print the result.  Am I opening the correct database to be able to query QoS data?  And, why would it return a null value?  Any ideas?

--Open the Nimsoft Database"Provider=SQLOLEDB;Initial Catalog=NimbusSLM;Data Source=mysource;User ID=sa;Password=mypassword;Network Library=dbmssocn;Language=us_english")
--Create a table for the sql command result
powerTable = database.query("SELECT MAX(samplevalue) FROM RN_QOS_DATA_0156")
powerTable = powerTable
printf("%d", powerTable)
--Close the Nimsoft Database

---------- Capture Output ----------
> "C:\Program Files\Nimbus\sdk\nsa\nsa.exe" -d 1 -l stdout "C:\Program Files\NimBUS\sdk\nsa\NEDprobePower.lua"
Oct  9 13:30:06:703 nsa: ------ Starting -------
Oct  9 13:30:06:812 nsa: Script error, C:\Program Files\NimBUS\sdk\nsa\NEDprobePower.lua:61: bad argument #2 to 'printf' (number expected, got nil)

> Terminated with exit code 0.