Click here to Skip to main content
15,793,845 members
Home / Discussions / Database
   

Database

 
Questioninstallation Pin
Kissy163-Jul-08 0:50
Kissy163-Jul-08 0:50 
AnswerRe: installation Pin
John_Adams3-Jul-08 6:35
John_Adams3-Jul-08 6:35 
QuestionStored Procedure or Trigger for Autogenerate Colunm Pin
rrrriiizz2-Jul-08 21:45
rrrriiizz2-Jul-08 21:45 
AnswerRe: Stored Procedure or Trigger for Autogenerate Colunm Pin
Mycroft Holmes2-Jul-08 21:56
professionalMycroft Holmes2-Jul-08 21:56 
I am going to assume you are trying to create a key field for your employee, if so then:
DO NOT ADD INTELLIGENCE TO A PRIMARY ID/KEY FIELD, you are doing this by adding the first character of the surname. This is wrong, it should simply be the record identifier, use the surname field for search/sorting NOT the ID field.

Generating an employee number for human consumption (timecards or something) is a different matter. I would put it in the inserting stored procedure (I never use triggers)

Before the insert get the count of existing surnames with the 1st char
Select @N = (count(*) + 1) From Employee where Surname like 'A%' (this fails when the employee changes surnames - gets married and is the reason for the initial comment)
or
Select top 1 employee where ENO like 'A%'
order by ENO desc

Add the text to the ENO field


Never underestimate the power of human stupidity
RAH

GeneralRe: Stored Procedure or Trigger for Autogenerate Colunm Pin
rrrriiizz2-Jul-08 22:34
rrrriiizz2-Jul-08 22:34 
GeneralRe: Stored Procedure or Trigger for Autogenerate Colunm Pin
rrrriiizz3-Jul-08 2:09
rrrriiizz3-Jul-08 2:09 
GeneralRe: Stored Procedure or Trigger for Autogenerate Colunm Pin
Mycroft Holmes4-Jul-08 1:26
professionalMycroft Holmes4-Jul-08 1:26 
GeneralRe: Stored Procedure or Trigger for Autogenerate Colunm Pin
rrrriiizz5-Jul-08 2:35
rrrriiizz5-Jul-08 2:35 
QuestionTrigger with Time Pin
obarahmeh2-Jul-08 21:08
obarahmeh2-Jul-08 21:08 
AnswerRe: Trigger with Time Pin
Mycroft Holmes2-Jul-08 22:00
professionalMycroft Holmes2-Jul-08 22:00 
GeneralRe: Trigger with Time Pin
obarahmeh2-Jul-08 23:50
obarahmeh2-Jul-08 23:50 
QuestionsqlDataReader Execution in a Function Pin
IlseBrase2-Jul-08 19:29
IlseBrase2-Jul-08 19:29 
AnswerRe: sqlDataReader Execution in a Function Pin
Vimalsoft(Pty) Ltd3-Jul-08 5:03
professionalVimalsoft(Pty) Ltd3-Jul-08 5:03 
QuestionSQL image data Pin
nelsonpaixao2-Jul-08 15:02
nelsonpaixao2-Jul-08 15:02 
AnswerRe: SQL image data Pin
Giorgi Dalakishvili2-Jul-08 22:58
mentorGiorgi Dalakishvili2-Jul-08 22:58 
AnswerRe: SQL image data Pin
Hesham Amin2-Jul-08 23:08
Hesham Amin2-Jul-08 23:08 
QuestionConnection-string [modified] Pin
nelsonpaixao2-Jul-08 14:59
nelsonpaixao2-Jul-08 14:59 
AnswerRe: Connection-string Pin
rrrriiizz2-Jul-08 20:31
rrrriiizz2-Jul-08 20:31 
GeneralRe: Connection-string Pin
Mycroft Holmes2-Jul-08 22:12
professionalMycroft Holmes2-Jul-08 22:12 
QuestionOracle instant client Pin
Muammar©2-Jul-08 2:00
Muammar©2-Jul-08 2:00 
QuestionFinaly I Found it. Compare and synchronize SQL Server database structures and data. Pin
dingoishere2-Jul-08 1:12
dingoishere2-Jul-08 1:12 
AnswerRe: Finaly I Found it. Compare and synchronize SQL Server database structures and data. Pin
Syed Mehroz Alam2-Jul-08 19:44
Syed Mehroz Alam2-Jul-08 19:44 
QuestionPerformance Issue Pin
sujithkumarsl1-Jul-08 20:43
sujithkumarsl1-Jul-08 20:43 
AnswerRe: Performance Issue Pin
Paul Conrad1-Jul-08 21:03
professionalPaul Conrad1-Jul-08 21:03 
GeneralRe: Performance Issue Pin
sujithkumarsl1-Jul-08 21:24
sujithkumarsl1-Jul-08 21:24 

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.