i am using sql server 2008 R2.. i want to store data in sql table..i am facing a error in this syntax..
the error is ..
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
I check for order of parameter and no. of paramtr in table and query..
please help..
thanks in advance
USE [SCJ]
GO
/****** Object: StoredProcedure [dbo].[spGetCHLDETAIL1] Script Date: 03/20/2014 22:30:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <author,,name>
-- Create date: <create>
-- Description: <description,,>
-- =============================================
ALTER PROCEDURE [dbo].[spGetCHLDETAIL1]
-- Add the parameters for the stored procedure here
@DistrictID VARCHAR(250),
@barcode VARCHAR(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE
@ChildTblName AS VARCHAR (125),
@FamilyTblName AS VARCHAR (125),
@vquery1 AS varchar(max),
@vQuery AS VARCHAR (max);
SET @ChildTblName = '[' + @DistrictID + 'Child_D' + ']'
SET @FamilyTblName = '[' + @DistrictID + 'Family_D' + ']'
SET @vQuery =
Child.cname, Child.sex,Child.dob, Child.disability,Child.sch_code,Child.class,Child.nereason,Child.droupout,Child.highclass
FROM
Child.barcode=Family.barcode WHERE LTRIM(RTRIM(Child.cname)) <>
insert into CHLDINFO_LOG1
(
distic
,block
,GP
,village
,habitation
,location
,residing
,mother_ton
,Pincode
,House_no
,Father
,Mother
,Guardian
,social_grp
,Minority
,Male
,Female
,seasnal_mgrtn
,Mgrtn_Type
,durtn_Mgrtn
,LP
,UP
,SEC
,Ctchmnt_LP
,Ctchmnt_UP
,Ctchmnt_SEC
,Chld_Name
,SEX
,DOB
,Disblty_type
,Schl_CODE
,CLASS
,NEREASON
,DRPOUT_rsn
,HIGH_class
) values(@vQuery);