Solved

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

Posted on 2006-11-20
5
240 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]
Comment Utility
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
Comment Utility
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
Comment Utility
i mean to say "Apply Parenthesis after the AND"
0
 

Author Comment

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

Author Comment

by:ckawebcreation
Comment Utility
good skills imran!!!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SLQ View not updating 10 46
TSQL mapping detailed records to group records 9 26
Save sql query result in sql server 15 22
Sql query 34 16
In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
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 …
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.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

763 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

9 Experts available now in Live!

Get 1:1 Help Now