Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Need help to save SQL Expression in database

Author  Topic 

Idyana
Yak Posting Veteran

96 Posts

Posted - 2014-08-14 : 04:44:40
Hi,

This is my Education List table


I intend to allow user to create their own Qualification for Job Vacancy. May be as following,


My question..
1- It's possible the Expression - [Level] = '2' And [StudyField] = '71' And [CGPA] >= '2.5' to combine with T-SQL in database?

Please help

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-14 : 08:02:45
Yes, it's possible. Store the expression in an NVARCHAR column. Then use it with dynamic SQL to execute it on demand.

It's a really bad idea though. What if someone creates an expression that reads "; DELETE FROM sometable; DROP DATABASE somedatabase;"?
Go to Top of Page

Idyana
Yak Posting Veteran

96 Posts

Posted - 2014-08-14 : 09:02:34
tq sir. I will make sure the user cannot simply to enter the disaster expression.
Go to Top of Page
   

- Advertisement -