say i have this file (below) and want to enter it into a table i've made. why cant i do this in query analyzer? and whats the easiest/best way to do it
insert into myTable
values(1,"StaticHtml","StaticHtmlPageControl"
2,"Questions","QuestionsPageControl"
3,"Login","LoginPageControl"
4,"SubmitSurvey","SubmitSurveyPageControl"
5,"Registration","RegistrationPageControl"
7,"SubmitUserAttributesSurvey","SubmitUserAttributesSurveyControl"
10,"RepeatPageGroup","RepeatPage"
11,"ThankYouPage","ThankYouPageControl")
also
whats the easiest way to make a copy of a database with and without the data - on the same server
cheers
Your SQL syntax isn't quite right. You'll need to write an INSERT INTO for each row you want to insert. i.e.
INSERT INTO myTable VALUES(1,"StaticHtml","StaticHtmlPageControl")
INSERT INTO myTable VALUES(2,"Questions","QuestionsPageControl")
You can script the database structure in order to create a blank instance of your database - Enterprise Manager / SQL Management Studio has options for this. To "copy" your database including data, you should take a backup.
|||Thx man
bit annoying how u have to write insert into for each row, especially if there's heaps of rows.. i was hoping there might have been a better/easier way
i was also hoping you could copy a database like a table eg: select * into db1 from db2 - or something similar
anyway, i'll just keep hoping
cheers
|||If you're selecting data from one table into another, you can do multiple rows - like this
INSERT INTO tblTable1
SELECT * FROM tblTable2
If the fields don't match, just specify the columns:
INSERT INTO tblTable1 (Field1, Field2, Field3)
SELECT FieldA, FieldB, FieldC FROM tblTable2
No comments:
Post a Comment