Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure?

Status
Not open for further replies.

memcom

MIS
Nov 19, 2002
56
US
Right before a report gets populated with new data, I need to have a set of SQL commands run to check to see if any value in a certain field is null and if so populate it with a given value. Is this possible from inside a crystal report? Can it be done with a stored procedure and if so, where can I get information on how to have Crystal use a stored procedure like this?

Thanks,
Michael
 
Hi
U can use Isnull(field,value) in stored procedure to check the value of the field in SP. If u r creating a temporary table and using the same in Report u should do this in SP. If u r not using Temporary table in SP then U can check it in report aslo using isnull function it returns true or false. if isnull(field) then statement1 else statement2
or if isnull(field) = true/false then statement1 else statement2

Regards
Lokesh
 
Hi Michael,

If you are using MS SQL Server you can use the COALESCE function
SELECT COALESCE(MyField, 'My value') FROM MyTable
If MyField is NULL this displays 'My value' instead.

As for Crystal you can also create a formula which does the same thing...

If IsNull(MyField) Then
'My value'
Else
MyField

Hope this helps.

Cheers,
phirst.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top