system.db.runScalarQuery command works in Script Console but not in Calculated Pipeline script

I have a system.db.runScalarQuery script that works in Script Console but not in Calculated Pipeline script. Any ideas why?

NewV = system.db.runScalarQuery(“SELECT COUNT(*) FROM NewTable where id = 1 AND date IS NULL”)

If commented out in the Calculated Pipeline script runs as it should. In the Script Console I can just add a “Print NewV” and it works fine.

Have you tried adding your database name into it?

NewV = system.db.runScalarQuery(“SELECT COUNT(*) FROM NewTable where id = 1 AND date IS NULL”,"Your DB Name")

That worked!

So in the Script Console it grabs the default database but elsewhere, maybe not. :slight_smile:

1 Like