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

Database

 
GeneralRe: Optimizing Query - Order by inner joined value Pin
andyharman9-Jan-08 2:45
professionalandyharman9-Jan-08 2:45 
GeneralRe: Optimizing Query - Order by inner joined value Pin
gnjunge9-Jan-08 7:11
gnjunge9-Jan-08 7:11 
GeneralStored Procedure Pin
simworld7-Jan-08 3:47
simworld7-Jan-08 3:47 
GeneralRe: Stored Procedure Pin
Colin Angus Mackay7-Jan-08 7:28
Colin Angus Mackay7-Jan-08 7:28 
GeneralRe: Stored Procedure Pin
simworld7-Jan-08 8:12
simworld7-Jan-08 8:12 
Questioninserting into SQL table with just a primary key column? Pin
michal.kreslik6-Jan-08 7:11
michal.kreslik6-Jan-08 7:11 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Paul Conrad6-Jan-08 10:00
professionalPaul Conrad6-Jan-08 10:00 
GeneralRe: inserting into SQL table with just a primary key column? Pin
michal.kreslik6-Jan-08 21:07
michal.kreslik6-Jan-08 21:07 
Paul,

thanks for the reply.

It's exactly what my design is. There's just one column and it is being autogenerated.

Let's say this table is named Table_A. The sole auto int PK column in Table_A is named Table_A_Id.

Let's say there's another table, Table_B. This Table_B contains, among other things, a column named Table_A_Id. There is a foreign key relationship between Table_A.Table_A_Id and Table_B.Table_A_Id. By way of this FK relationship, the unique Table_A.Table_A_Id rows are being linked to many Table_B.Table_A.Id rows.

Each time I insert a new row into Table_A, I get the last autogenerated PK by issuing SELECT @@IDENTITY. I take this last PK from Table_A and insert multiple rows to Table_B that link to this Table_A.Table_A_Id.

The problem is that if Table_A only contains one autogenerated PK column, there's actually nothing to insert (no columns, no values) into Table_A. My current workaround is that I've added a text column named Comment to Table_A. I'm generating a new row in Table_A by issuing INSERT INTO Table_A (Comment) VALUES ('') then.

But I'd like to find out how to generate a new row in Table_A with no workarounds.

Thanks much,
Michal
GeneralRe: inserting into SQL table with just a primary key column? Pin
Pete O'Hanlon6-Jan-08 22:49
mvePete O'Hanlon6-Jan-08 22:49 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Paul Conrad7-Jan-08 7:40
professionalPaul Conrad7-Jan-08 7:40 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Chris Meech7-Jan-08 7:12
Chris Meech7-Jan-08 7:12 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Paul Conrad7-Jan-08 7:44
professionalPaul Conrad7-Jan-08 7:44 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Mark Churchill7-Jan-08 12:21
Mark Churchill7-Jan-08 12:21 
GeneralRe: inserting into SQL table with just a primary key column? Pin
Vimalsoft(Pty) Ltd6-Jan-08 20:05
professionalVimalsoft(Pty) Ltd6-Jan-08 20:05 
GeneralRe: inserting into SQL table with just a primary key column? Pin
michal.kreslik6-Jan-08 21:09
michal.kreslik6-Jan-08 21:09 
GeneralRe: inserting into SQL table with just a primary key column? Pin
obymathew10-Jan-08 13:29
obymathew10-Jan-08 13:29 
GeneralDistinct in SQL Server Pin
.NET- India 4-Jan-08 23:19
.NET- India 4-Jan-08 23:19 
GeneralRe: Distinct in SQL Server Pin
Vimalsoft(Pty) Ltd5-Jan-08 7:37
professionalVimalsoft(Pty) Ltd5-Jan-08 7:37 
GeneralRe: Distinct in SQL Server Pin
.NET- India 6-Jan-08 18:33
.NET- India 6-Jan-08 18:33 
GeneralRe: Distinct in SQL Server Pin
Vimalsoft(Pty) Ltd6-Jan-08 20:03
professionalVimalsoft(Pty) Ltd6-Jan-08 20:03 
GeneralRe: Distinct in SQL Server Pin
.NET- India 6-Jan-08 20:14
.NET- India 6-Jan-08 20:14 
QuestionOracle, BizTalk, SQL Server Pin
Ph@ntom4-Jan-08 20:39
Ph@ntom4-Jan-08 20:39 
GeneralRe: Oracle, BizTalk, SQL Server Pin
Vimalsoft(Pty) Ltd5-Jan-08 7:45
professionalVimalsoft(Pty) Ltd5-Jan-08 7:45 
GeneralRe: Oracle, BizTalk, SQL Server Pin
Paul Conrad5-Jan-08 9:57
professionalPaul Conrad5-Jan-08 9:57 
GeneralRe: Oracle, BizTalk, SQL Server Pin
Pete O'Hanlon5-Jan-08 10:22
mvePete O'Hanlon5-Jan-08 10: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.