Solved

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

Posted on 2006-11-20
5
243 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 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

840 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