Click here to Skip to main content
15,899,754 members
Home / Discussions / Database
   

Database

 
GeneralRe: C# SQL express Login Pin
kadaen30-Dec-09 0:06
kadaen30-Dec-09 0:06 
GeneralRe: C# SQL express Login Pin
nagendrathecoder30-Dec-09 0:13
nagendrathecoder30-Dec-09 0:13 
GeneralRe: C# SQL express Login Pin
kadaen30-Dec-09 2:58
kadaen30-Dec-09 2:58 
GeneralRe: C# SQL express Login Pin
nagendrathecoder30-Dec-09 17:25
nagendrathecoder30-Dec-09 17:25 
AnswerRe: C# SQL express Login Pin
loyal ginger30-Dec-09 15:41
loyal ginger30-Dec-09 15:41 
GeneralRe: C# SQL express Login Pin
c0der200930-Dec-09 23:01
c0der200930-Dec-09 23:01 
GeneralRe: C# SQL express Login Pin
kadaen31-Dec-09 4:14
kadaen31-Dec-09 4:14 
Questioncreate & update account numbersfor existing records Pin
Jassim Rahma29-Dec-09 22:52
Jassim Rahma29-Dec-09 22:52 
I have the following code to update the account number in the account summary & clients tables when creating a new client profile but I have a major problem now with existing records as the account concept was proposed lately.. I want to know how can I use the same code to loop through all existing (already created) records and define an account number for it?

note: I want a random weekday and dayofyear so not all records will have the same weekday creation..


INSERT INTO clients (company_id, client_name, client_cpr, client_passport, client_gender, client_nationality, client_date_of_birth, client_visa_number, client_visa_expiry, client_workpermit_number, client_workpermit_expiry, client_telephone, client_fax, client_mobile, send_sms, client_occupation, client_email, send_emails, client_salary, home_country_address, client_is_vip, client_is_blacklist) VALUES (@company_id, @client_name, @client_cpr, @client_passport, @client_gender, @client_nationality, @client_date_of_birth, @client_visa_number, @client_visa_expiry, @client_workpermit_number, @client_workpermit_expiry, @client_telephone, @client_fax, @client_mobile, @send_sms, @client_occupation, @client_email, @send_emails, @client_salary, @home_country_address, @client_is_vip, @client_is_blacklist)
SET @record_identity = SCOPE_IDENTITY()
INSERT INTO accounts_summary (client_category, client_id, cr_cpr_number, account_number, account_name) VALUES ('I', @record_identity, @client_cpr, SCOPE_IDENTITY(), @client_name)
SET @account_number_string = RIGHT('0' + convert(varchar(1), DATEPART(WEEKDAY, GETDATE())), 1)
SET @account_number_string = @account_number_string + RIGHT('000' + convert(varchar(3), DATEPART(DAYOFYEAR, GETDATE())), 3)
SET @account_number_string = @account_number_string + RIGHT('0000000' + convert(varchar(7), SCOPE_IDENTITY()), 7)
SET @account_number = convert(bigint, @account_number_string)
UPDATE accounts_summary SET account_number = @account_number WHERE account_id = SCOPE_IDENTITY()
UPDATE clients SET account_number = @account_number WHERE client_id = @record_identity

AnswerRe: create & update account numbersfor existing records Pin
Andy_L_J30-Dec-09 3:21
Andy_L_J30-Dec-09 3:21 
GeneralRe: create & update account numbersfor existing records Pin
Jassim Rahma31-Dec-09 2:01
Jassim Rahma31-Dec-09 2:01 
QuestionIntegrate sql server's Query Editor Window with C# Project Pin
Dot-Net-Dev29-Dec-09 22:26
Dot-Net-Dev29-Dec-09 22:26 
QuestionHow to access a password protected MS Access database Pin
pc_dev29-Dec-09 1:05
pc_dev29-Dec-09 1:05 
AnswerRe: How to access a password protected MS Access database Pin
Eddy Vluggen29-Dec-09 1:53
professionalEddy Vluggen29-Dec-09 1:53 
GeneralRe: How to access a password protected MS Access database Pin
pc_dev30-Dec-09 6:46
pc_dev30-Dec-09 6:46 
QuestionTSQL DATETIME Pin
cdpace28-Dec-09 21:58
cdpace28-Dec-09 21:58 
AnswerRe: TSQL DATETIME Pin
Eddy Vluggen28-Dec-09 23:05
professionalEddy Vluggen28-Dec-09 23:05 
AnswerRe: TSQL DATETIME PinPopular
WoutL29-Dec-09 0:21
WoutL29-Dec-09 0:21 
GeneralRe: TSQL DATETIME Pin
cdpace29-Dec-09 3:16
cdpace29-Dec-09 3:16 
QuestionInteresting question about a MIN function and usage Pin
James Shao28-Dec-09 15:10
James Shao28-Dec-09 15:10 
AnswerRe: Interesting question about a MIN function and usage Pin
Luc Pattyn28-Dec-09 15:37
sitebuilderLuc Pattyn28-Dec-09 15:37 
GeneralRe: Interesting question about a MIN function and usage [modified] Pin
James Shao28-Dec-09 21:51
James Shao28-Dec-09 21:51 
GeneralRe: Interesting question about a MIN function and usage Pin
Luc Pattyn29-Dec-09 0:57
sitebuilderLuc Pattyn29-Dec-09 0:57 
GeneralRe: Interesting question about a MIN function and usage Pin
James Shao29-Dec-09 4:24
James Shao29-Dec-09 4:24 
AnswerRe: Interesting question about a MIN function and usage [modified] Pin
Corporal Agarn29-Dec-09 4:30
professionalCorporal Agarn29-Dec-09 4:30 
GeneralRe: Interesting question about a MIN function and usage Pin
James Shao30-Dec-09 12:47
James Shao30-Dec-09 12:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.