I was wondering if it is possible to move all rows of data from one table to another, that match a certain query?
For example, I need to move all table rows from Tab
Yes it is. First INSERT + SELECT and then DELETE orginals.
INSERT INTO Table2 (UserName,Password)
SELECT UserName,Password FROM Table1 WHERE UserName='X' AND Password='X'
then delete orginals
DELETE FROM Table1 WHERE UserName='X' AND Password='X'
you may want to preserve UserID
or someother primary key, then you can use IDENTITY INSERT
to preserve the key.
see more on SET IDENTITY_INSERT on MSDN