Pho3nix
The Legend
Is it possible to copy over the data from a View into another Table without the relationships?
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Or
SELECT * INTO NewTable FROM View
Only works if your view and table is in the same format and fields are in the same order, etc.
Safer to manually select the fields you are interested in -- don't mislead the noobs X![]()
The SELECT INTO statement creates a new table and populates it with the result set of the SELECT statement. SELECT INTO can be used to combine data from several tables or views into one table. It can also be used to create a new table that contains data selected from a linked server.
Only works if the table doesn't exist.
Is it possible to copy over the data from a View into another Table without the relationships?
SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
Ok, that worked, thanks guys. Another question though (I'm a SQL Noob). I need a query that will get me the Current month from the System(?), then select only records in the table which are in that month. Hope you guys get me.
So far i have :but it gets stuck during debugging.. wrong syntax?Code:SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
SELECT * from Test_Table WHERE MONTH(Date_Worked)=GETDATE()
SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
AND YEAR(Date_Worked)=YEAR(GETDATE())
No... because that'll only get the current day, not the month.
Code:SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
Wont work because a month can be in each year...
Code:SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE()) AND YEAR(Date_Worked)=YEAR(GETDATE())
No... because that'll only get the current day, not the month.
Code:SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE())
Wont work because a month can be in each year...
Code:SELECT * from Test_Table WHERE MONTH(Date_Worked)=MONTH(GETDATE()) AND YEAR(Date_Worked)=YEAR(GETDATE())
Is it possible to run more than one SQL Query ie. First Query (Global?) selects all the data from the month, the other queries set how many rows should be selected because the eg.price of an item is less than 20 and I want to select 1% of the items that fit this description. Thoughts? Hope I made sense.