SQL Server: modify data file size and shrink When I try to modify the Database File Size, it shows this error.


  Specified size is less than or equal to current size


I tried this query:

Alter database [dbname] modify file
(
 name=N'data-file-name', size=(newsize=90MB)
);


Now it works when I tried to shrink it, I mean change it from 100MB to 90MB, using this query that I saw on the internet:

DBCC ShrinkFile(data_file_name,size to)

But why?

Why can't I modify the file size to a smaller size and why shrinking it works?

What happens when I shrink a file and when I modify the file size?
When DB itself perform the shrink operation then it computes the value stored in the DB and try to store them in such a way that they takes less size, hence you see reduced size of DB. OTOH when you are saying that you want to modify size, then are you telling your DB in which order it should rearrange your data such that your data remain unchanged?