To see if a value exists in a table you use a SELECT statement.
WHERE UserName = ‘The UserName’</pre>
When building an appliction you would typically use a stored procedure to handle all data lookups and modification. You would pass the stored procedure the values you want to check. Something like this.
<pre>CREATE PROCEDURE usp_CheckLogin
IF EXISTS (SELECT * FROM TableName WHERE UserName = @UserName)
SELECT ‘User Exists’
SELECT ‘User Does Not Exist’
You can now run this procedure passing it the username you want to check.
<pre>exec usp_CheckLogin @UserName = N’mrdenny’</pre>
If there is a record in the table with the username of “mrdenny” then the response will be “User Exists”, otherwise it will be “User Does Not Exist”.
Data modification is done in a simalar way via the INSERT, UPDATE or DELETE statements depending on what operation you want to perform.
I would recommend reading up on these commands in Books OnLine (BOL). BOL is the help documentation which comes with MSDE and can provide you with more examples of the syntax of these commands.