Showing posts with label supplied. Show all posts
Showing posts with label supplied. Show all posts

Saturday, February 11, 2012

"Column name or number of supplied values does not match table definition" when trying to

Hello,
I am receiving the following error:
Column name or number of supplied values does not match table definition
I am trying to insert values into a temp table, using values from the table I copied the structure from, like this:
SELECT TOP 1 * INTO #tbl_User_Temp FROM tbl_User
TRUNCATE TABLE #tbl_User_Temp
INSERT INTO #tbl_User_Temp EXECUTE UserPersist_GetUserByCriteria @.Gender = 'Male', @.Culture = 'en-GB'
The SP UserPersist_GetByCriteria does a"SELECT * FROM tbl_User WHERE gender = @.Gender AND culture = @.Culture",so why am I receiving this error when both tables have the samestructure?
The error is being reported as coming from UserPersist_GetByCriteria on the "SELECT * FROM tbl_User" line.
Thanks,
Greg.
hello...
this might be simplified version..
SELECT * INTO #tbl_User FROM tbl_User WHERE Gender='Male' AND Culture='en-GB'
and there might be idenity column on your original tbl_User..?
i tested a table with identity column, same error msg (just guess)|||In addition to busyweb's reply, if you do need to create an empty temptable using SELECT INTO in the future, try the following instead of TOP1 + TRUNCATE:
SELECT *
INTO #Tbl
FROM SomeTable
WHERE 1=0