Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello ,

SQL
CREATE TABLE [dbo].[tb_mst_Attachement](
    [MessageId_int] [int] NULL,
    [Document_nvarchar] [nvarchar](50) ,
    [ImagePath] [nvarchar](max)
)


CREATE TABLE [dbo].[tb_mst_Message](
    [MessageId_int] [int] IDENTITY(1,1) NOT NULL,
    [Subject_nvarchar] [nvarchar](max) COLLATE Latin1_General_CI_AI NULL,
    [Message_nvarchar] [nvarchar](max) COLLATE Latin1_General_CI_AI NULL,
    [IsAttachment] [int] NULL,
)


insert into tb_mst_Message ( SenderId_int, ReceiverId_int, Subject_nvarchar )values (101,202,'hii')

insert into tb_mst_Attachement values((select max(MessageId_int) from tb_mst_Message),'hi','how r u')

in my last querry there is an error so plz tell me correct querry for this purpose

Thanks & Regards
Srishti
Posted
Updated 17-Jun-13 2:37am
v3
Comments
AmitGajjar 17-Jun-13 8:06am    
what is the error message ?
AmitGajjar 17-Jun-13 8:12am    
i have executed your query and it seems like you have incorrect column name in your first insert query.
[no name] 17-Jun-13 8:14am    
First of all, you do not have a SenderId_int column or a ReceiverId_int column defined in your tb_mst_Message table, according to your schema.
ArunRajendra 17-Jun-13 8:16am    
SenderId_int, ReceiverId_int columns are missing in table tb_mst_Message
RedDk 17-Jun-13 14:35pm    
Yeah,

Msg 207, Level 16, State 1, Line 1
Invalid column name 'SenderId_int'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ReceiverId_int'.

1 solution

What is it with people discussing questions and not posting answers when they answer ? You need to read your error messages, they mean what they say. The columns you are naming, do not exist. The error is correct.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900