[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Sql query

Hi,

Can someone explain to me what this SQL statement doing here?

"select sysdba.GNL_POT('" + contactID.Trim() + "') as ts_pot";

As I found this in my C# project for the sqlcommand sql statement with the connection object as the second parameter. Im bit confused with GNL_POT is that a table or function or view or what?

Any help very grately appreciated.

Thanks!
0
ube100
Asked:
ube100
4 Solutions
 
dqmqCommented:
Looks like a function to me.  Given the argument contact_Id.trim(), which is a variable in the c# program
0
 
HainKurtSr. System AnalystCommented:
it is running a user defined function and passing contact id from your app

you should find the code for GNL_POT and check what it returns...
0
 
databoksCommented:
Look under the Tables, functions, views until you find it.

0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
iI could say that also.

note though that this is ad-hoc build sql, you should consider changing that into parameterized code to avoid sql injection ...
0
 
HainKurtSr. System AnalystCommented:
what it returns? you can check it on your app, maybe it will help you understand it without checking the code
0
 
ube100Author Commented:
Yes,

That is a function so how do I execute in the Management studio and get the return value?
0
 
dj_alikCommented:
this is the user defined  function only function can be used in select  with parameter.
you can execute tgis  sql to see all your functions in  selected database:
USE YOUR_DATABASE;
 GO
 SELECT name AS function_name
 ,SCHEMA_NAME(schema_id) AS schema_name
 ,type_desc
 FROM sys.objects
 WHERE type_desc LIKE '%FUNCTION%';
 GO
 


 
0
 
databoksCommented:
Please provide the code of the function.  It will help alot.

We can also explain what it does.
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
You would go into Management Studio in the database that you are going to execute it against.  Then execute:

select sysdba.GNL_POT('1') as ts_pot
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now