Solved

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

Posted on 2006-11-20
5
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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.
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

739 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