Click here to Skip to main content
15,917,328 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to calculate sum of count of cloumn? [modified] Pin
Blue_Boy11-May-08 23:54
Blue_Boy11-May-08 23:54 
QuestionHow to Match case in access Pin
E_Gold10-May-08 21:44
E_Gold10-May-08 21:44 
AnswerRe: How to Match case in access Pin
soporificeffect11-May-08 3:25
soporificeffect11-May-08 3:25 
GeneralRe: How to Match case in access Pin
Rob Graham11-May-08 4:45
Rob Graham11-May-08 4:45 
AnswerRe: How to Match case in access Pin
Rob Graham11-May-08 4:51
Rob Graham11-May-08 4:51 
QuestionSimple style ComboBox Control Pin
Member 41292189-May-08 22:29
Member 41292189-May-08 22:29 
AnswerRe: Simple style ComboBox Control Pin
Hesham Amin9-May-08 22:45
Hesham Amin9-May-08 22:45 
Questiondynamic trigger for a dynamic table Pin
Member 40084929-May-08 6:10
Member 40084929-May-08 6:10 
AnswerRe: dynamic trigger for a dynamic table Pin
Blue_Boy9-May-08 7:23
Blue_Boy9-May-08 7:23 
QuestionProblem with RSClient Print paging Pin
jeguzmanv9-May-08 5:40
jeguzmanv9-May-08 5:40 
AnswerRe: Problem with RSClient Print paging Pin
CodingYoshi10-May-08 9:58
CodingYoshi10-May-08 9:58 
GeneralRe: Problem with RSClient Print paging Pin
jeguzmanv14-May-08 7:47
jeguzmanv14-May-08 7:47 
QuestionProblem with the Following SQL Query Pin
Vimalsoft(Pty) Ltd9-May-08 5:37
professionalVimalsoft(Pty) Ltd9-May-08 5:37 
AnswerRe: Problem with the Following SQL Query Pin
Blue_Boy9-May-08 6:18
Blue_Boy9-May-08 6:18 
GeneralRe: Problem with the Following SQL Query Pin
Vimalsoft(Pty) Ltd9-May-08 22:57
professionalVimalsoft(Pty) Ltd9-May-08 22:57 
GeneralRe: Problem with the Following SQL Query Pin
Blue_Boy10-May-08 1:44
Blue_Boy10-May-08 1:44 
AnswerRe: Problem with the Following SQL Query Pin
Ashfield9-May-08 22:40
Ashfield9-May-08 22:40 
QuestionForeign Key in SQL server Pin
Arun Krishnan9-May-08 1:51
Arun Krishnan9-May-08 1:51 
AnswerRe: Foreign Key in SQL server Pin
Ashfield9-May-08 3:09
Ashfield9-May-08 3:09 
AnswerRe: Foreign Key in SQL server Pin
Hesham Amin9-May-08 3:13
Hesham Amin9-May-08 3:13 
AnswerRe: Foreign Key in SQL server Pin
Arsene Cormier9-May-08 7:40
Arsene Cormier9-May-08 7:40 
AnswerRe: Foreign Key in SQL server Pin
Rob Graham10-May-08 7:12
Rob Graham10-May-08 7:12 
First, I would make the foreighn key field a NOT NULL field to prevent accidental insert without a non-null value for EMPDETAILS.EMPID.
2nd, make EMPDETAILS.EMPID have a Foreign Key constraint - this would require that the value supplied be a value that exisits in LOGIN.EMPID column
 Alter table EMPDETAILS (Alter column EMPID NOT NULL)
 ALter table EMPDETAILS ADD CONSTRAINT FK_LOGIN FOREIGN_KEY (EMPID) references LOGIN (EMPID)

  Create a stored procedure for the combined insert: 
  (use appropriate types and sizes for your tables,
  this is just an example of how, hot a solution)
Create procedure AddNewEMPID (@Empid nvarchar (20), @name nvarchar(20), @age int, @loginstuff1 varchar(10),...,@loginstuffN int)
as
begin 
 insert into login (empid, lofinstuff1,...loginstuffN) values (@empid, @loginstuff1,...,@loginstuffN);
 insert into EMPDETAILS(empid,name,age) values (@empid, @name,@age);
end


call the stored procedure with values for the parameters either in code (you didn't say what language, but most have a database library like ADO.net, ADO, ODBC etc. that support parameterized query execution)
of in sql query analizer as

exec AddNewEMPID 'empidstring','l1,...,'ln', 'name','age'

QuestionDelete and Truncate Pin
.NET- India 9-May-08 1:29
.NET- India 9-May-08 1:29 
AnswerRe: Delete and Truncate Pin
Ashfield9-May-08 1:54
Ashfield9-May-08 1:54 
GeneralRe: Delete and Truncate Pin
.NET- India 9-May-08 2:27
.NET- India 9-May-08 2:27 

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.