Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Edit first 200 rows

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2011-02-14 : 16:00:19
In the sql server studio manager, you have an option to edit but only the first 200 rows, how can one edit later rows than that?
I can do update statements but they can be hairy at times if you don't know so well what you are doing, for test data.

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-02-14 : 16:06:39
Using an update statement isn't that hairy, as you can first issue a SELECT to make sure only the intended records are affected. It is far more controllable than editing via SMSS.

If you have concerns or issues with the update syntax, post it here for help...but don't go typing changes into the data manually. THAT gets hairy.



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2011-02-14 : 16:52:36
OK so if I want to look at this group:
the datecreated is not working it is returning all dates
SELECT TOP 21000 [TransactionId]
,[CustomerId]
,[DepartmentId]
,[ItemId]
,[CategoryId]
,[Quantity]
,[Cost]
,[DateCreated]
,[InvoiceNumber]
,[DataSource]
,[DataSourceId]
,[ImportId]
,[LastUpdate]
FROM [DPI].[dbo].[Transactions]
where CustomerId = 1 and DepartmentId =13 and DateCreated > 2011-02-01
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-02-14 : 17:40:52
where CustomerId = 1 and DepartmentId =13 and DateCreated > '20110201'


You have to have dates surrounded by single quotes.

Essentially, what you criteria said was

DateCreated > 2008 (the result of 2011 minus 2 minus 1)

Since the date equivalent of the integer 2008 is 106 years ago..that might be why your query was returning the wrong results.

you can see here:
Select Cast(2011-02-01 as datetime)
Select Cast('20110201' as datetime)




Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page
   

- Advertisement -