Solved

wildcards for select query in sql server and dreamweaver in asp..

Posted on 2006-11-20
5
241 Views
Last Modified: 2009-07-29
hi,

i am using ms sql 2005 and dreamweaver with asp and I am trying to query a table for a member number and also a scheme type..  There are about 30 scheme types that can have access to the site and the rest are blocked access..  I am trying something like the code below, with no Joy!!    The MMColParam is a session variable with their user id stored in it and then I want to list the acceptable codes and if the code is like one in the list display the data, if the code is not in the list, give them an error..  I would really like to use a wildcard instead of a massive statement with loads of ands in it..  The format is fairly simple e.g. dir1f, dir2f, dir3f etc.. some of the others are corp1f, corp2f etc...  

They first log in and this is the page they get sent to, so the userid is always going to be in the session....

SELECT *
FROM dbo.[_authentication]
WHERE user_id = MMColParam AND [current_scheme] LIKE 'DIR_' OR [current_scheme] LIKE 'CORP_'

Any ideas or pointers would be great....

cheers
0
Comment
Question by:ckawebcreation
  • 2
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17978069
SELECT *
FROM dbo.[_authentication]
WHERE user_id = MMColParam AND [current_scheme] LIKE 'DIR_%' OR [current_scheme] LIKE 'CORP_%'
0
 
LVL 28

Accepted Solution

by:
imran_fast earned 125 total points
ID: 17978342
Appy parenthesis after the end

SELECT *
FROM dbo.[_authentication]
WHERE user_id = MMColParam AND( [current_scheme] LIKE 'DIR%' OR [current_scheme] LIKE 'CORP%' )
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17978347
i mean to say "Apply Parenthesis after the AND"
0
 

Author Comment

by:ckawebcreation
ID: 17979788
cheers guys, i will give it  a go and let you know how I get on!!
0
 

Author Comment

by:ckawebcreation
ID: 17979978
good skills imran!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now