November 3, 2010 at 9:37 am
I understand the structure of the INSERT INTO...VALUES. What i don't understand are the "<" and ">" marks along with the the datatypes being used in the VALUES section. Do the datatypes convert the data to that type? Why is there a VALUES section but no values? What good is that? Usually you would have actual values and not a repeat of the table columns.
INSERT INTO [UnionSchoolDist81].[dbo].[ClassList]
([Bus]
,[StuGrade]
,[StuSex]
,[stuEthnicity]
,[stuLastName]
,[stuFirstName]
,[stuMiddleName]
,[Address]
,[Town]
,[State]
,[ZIP]
,[Parent1FirstName]
,[Parent1LastName]
,[Parent2FirstName]
,[Parent2LastName]
,[HomePhone]
,[EmergencyPhone]
,[stuBirthDate]
,[SID]
,[Enrolled]
,[PID])
VALUES
(<Bus, nvarchar(50),>
,<StuGrade, nvarchar(50),>
,<StuSex, nvarchar(50),>
,<stuEthnicity, nvarchar(50),>
,<stuLastName, nvarchar(50),>
,<stuFirstName, nvarchar(50),>
,<stuMiddleName, nvarchar(50),>
,<Address, nvarchar(50),>
,<Town, nvarchar(50),>
,<State, nvarchar(50),>
,<ZIP, nvarchar(50),>
,<Parent1FirstName, nvarchar(50),>
,<Parent1LastName, nvarchar(50),>
,<Parent2FirstName, nvarchar(50),>
,<Parent2LastName, nvarchar(50),>
,<HomePhone, nvarchar(50),>
,<EmergencyPhone, nvarchar(50),>
,<stuBirthDate, nvarchar(50),>
,<SID, nvarchar(50),>
,<Enrolled, nvarchar(50),>
,<PID, nvarchar(50),>)
November 3, 2010 at 9:55 am
You have what you posted when you ask SSMS to generate an insert script for you. Generating an insert script doesn't generate the values you want to insert!
The marked up format you are describing are SSMS Template Parameters. At a base level, you can consider them a placeholder or sugar for a human operator. But, they can be used in more programmatic ways.
Try this: after you have this generated script, go to Query -> Specify Values for Template Parameters (or Ctrl-Shift-M)
If you're interested in more on the topic:
November 3, 2010 at 11:36 am
Put simply, those are placeholders. The "Script As" button has no clue what actual values you want, so it just puts something there that can help you fill in the blanks.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply