What's The Best Way To Tackle This?

Mar 17, 2008

Hi,

I'm doing a project at work. We're using SQL Server 2000 right now but will probably migrate to 2005 later. Here's my situation. My database stores feature request tickets. So I have columns for id, feature_request_number, summary, description, etc.

id is auto-increment (primary key). feature_request_number is a 6 char alpa-numeric. The first three are numbers, and the last three are FRQ...(ex. 034FRQ). What's the best way to implement the incrementation of that field? Since it's alpha-numeric I can't just make it auto-increment. I can drop the FRQ, but that would cause some complications with migrating the older database to the new one.

This is what my plan was:

- Set the feature_request_number as an int. (Drop the FRQ)
- When a record is being added, get the value of the last feature_request_number.
- Add 1 to it and specify that value in the INSERT statement.

So it's like a manual increment. Would I be able to do this all in SQL? Is there a way to form a SQL statement to get the value of a column and add 1 to it and save it to a variable. I want to do it in SQL to keep data integrity. I can have a stored procedure to do this and it would make life a lot simpler. The front-end of my app is a ASP.NET website, so it would be best to keep as much logic out of the ASP pages as much as possible.

Thanks in advance for your help.

View 3 Replies


ADVERTISEMENT

How Best To Tackle Logins With SQL Authentication After Automatic Failover

Aug 8, 2007

In an sql authentication environment with an automatic failover in database mirroring how to you manage new logins which have been created on the principle since the start of mirroring? Since the master cannot be mirrored, and the mirror database cannot be read during mirroring (except as a snapshot) in order to find the missing logins, I assume that only after failover a script should run to create the new logins and then run sp_change_users_login . The qestions are:

1) should the script create a new login first and then run sp_change_users_login with option update_one , or should sp_change_users_login using option

Auto_Fix create the missing logins?














2) But what is the password of these users? is it initially NULL , as a consequence of sp_change_users_login? What about the SIDs?

3) Or should we bypass sp_change_users_login altogether and use






CREATE LOGIN <loginname> WITH PASSWORD = <password>, SID = <sid for same login on principal server>,...as described in http://blogs.msdn.com/chadboyd/archive/2007/01/05/login-failures-connecting-to-new-principal-after-failover-using-database-mirroring.aspx



4) What is the event that would trigger this script to run after the aitomatic failover ?

Is there a definitive MIcrosoft agreed apon and recommended method to tackle this?



View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved