Click here to Skip to main content
15,886,919 members
Home / Discussions / Database
   

Database

 
QuestionNumber of Records [modified] Pin
T.RATHA KRISHNAN5-Oct-10 1:15
T.RATHA KRISHNAN5-Oct-10 1:15 
AnswerRe: Number of Records Pin
NeverHeardOfMe5-Oct-10 1:26
NeverHeardOfMe5-Oct-10 1:26 
GeneralRe: Number of Records Pin
T.RATHA KRISHNAN5-Oct-10 1:48
T.RATHA KRISHNAN5-Oct-10 1:48 
GeneralRe: Number of Records Pin
NeverHeardOfMe5-Oct-10 1:52
NeverHeardOfMe5-Oct-10 1:52 
GeneralRe: Number of Records Pin
T.RATHA KRISHNAN5-Oct-10 2:04
T.RATHA KRISHNAN5-Oct-10 2:04 
GeneralRe: Number of Records Pin
NeverHeardOfMe5-Oct-10 2:14
NeverHeardOfMe5-Oct-10 2:14 
GeneralRe: Number of Records Pin
T.RATHA KRISHNAN5-Oct-10 2:21
T.RATHA KRISHNAN5-Oct-10 2:21 
QuestionAdding new data in two tables [modified] Pin
Erdinc274-Oct-10 23:05
Erdinc274-Oct-10 23:05 
hey guys..i try to insert data in two tables which are related with each other... the first table name is
Mark and the columns mark_id and mark_name
and the second table name is Model
the columns are model_id,Model_name and mark_id and mark_id is FK here
now here is the thing i want to do for example i want to add Honda as Mark to mark table and the model Jazz,Civic etc as models that depends on the HOnda..To do that i created a stored Procedure like below

Create Procedure sp_TablolaraEkle
@marka_ad nvarchar(50),
@model_ad nvarchar(50)
as
Begin Try
Begin Transaction
Set Nocount on
Declare @id int
Declare @Marka nvarchar(50)
insert into Marka(marka_ad) values (@marka_ad)
Select @id=@@Identity
Declare @model_adi nvarchar(50)
insert into Model(marka_id,model_ad)values (@id,@model_ad)
Commit
End Try
Begin Catch
if @@Trancount>0
Rollback
End Catch

but the problem is for example i added Ferrari to mark table with id is 3 i can add its model too but when i want to add one more Ferrari model then it adds Ferrari model with different mark_id in model table
can u help me how it will get rid off the problem...thanks for your help

modified on Tuesday, October 5, 2010 5:28 AM

AnswerRe: Adding new data in two tables Pin
Gerben Jongerius4-Oct-10 23:39
Gerben Jongerius4-Oct-10 23:39 
GeneralRe: Adding new data in two tables Pin
Erdinc274-Oct-10 23:58
Erdinc274-Oct-10 23:58 
GeneralRe: Adding new data in two tables Pin
Mycroft Holmes5-Oct-10 0:25
professionalMycroft Holmes5-Oct-10 0:25 
GeneralRe: Adding new data in two tables Pin
Erdinc275-Oct-10 1:27
Erdinc275-Oct-10 1:27 
QuestionDeploying Reports for Reporting Services Pin
dwolver4-Oct-10 9:38
dwolver4-Oct-10 9:38 
NewsConcatenate two or more rows single string in SQL Pin
Sunasara Imdadhusen4-Oct-10 3:17
professionalSunasara Imdadhusen4-Oct-10 3:17 
GeneralRe: Concatenate two or more rows single string in SQL Pin
Blue_Boy4-Oct-10 3:37
Blue_Boy4-Oct-10 3:37 
GeneralRe: Concatenate two or more rows single string in SQL Pin
Mycroft Holmes4-Oct-10 12:06
professionalMycroft Holmes4-Oct-10 12:06 
GeneralRe: Concatenate two or more rows single string in SQL Pin
Sunasara Imdadhusen4-Oct-10 20:19
professionalSunasara Imdadhusen4-Oct-10 20:19 
QuestionTransaction to update multipel values in a table Pin
diePopster3-Oct-10 23:57
diePopster3-Oct-10 23:57 
AnswerRe: Transaction to update multipel values in a table Pin
Blue_Boy4-Oct-10 0:13
Blue_Boy4-Oct-10 0:13 
AnswerRe: Transaction to update multipel values in a table Pin
Pete O'Hanlon4-Oct-10 0:14
mvePete O'Hanlon4-Oct-10 0:14 
QuestionRe: Transaction to update multipel values in a table Pin
diePopster4-Oct-10 0:20
diePopster4-Oct-10 0:20 
AnswerRe: Transaction to update multipel values in a table Pin
Pete O'Hanlon4-Oct-10 1:02
mvePete O'Hanlon4-Oct-10 1:02 
QuestionSQL 2008 - Nested transactions Pin
ofirbt3-Oct-10 2:06
ofirbt3-Oct-10 2:06 
AnswerRe: SQL 2008 - Nested transactions Pin
masoumeh20104-Oct-10 22:41
masoumeh20104-Oct-10 22:41 
GeneralRe: SQL 2008 - Nested transactions Pin
ofirbt4-Oct-10 23:22
ofirbt4-Oct-10 23:22 

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.