Wednesday, February 15, 2012

Dynamic SQL Cells

How can I make the values for certain cells in a table in a database show the day a folder was created?

On the same note, How can I make other values in other cells change (say the values 101 through 200 had to change to 1-100)?

For the first part, you would have to explicily 'store' the "day a folder was created" in the field.

On the second part, if you wanted to subtract 100 from a current field value, and replace the current field value with that subtracted value, you would use a query similar to this one.

Code Snippet

UPDATE MyTable

SET MyColumn = ( MyColumn - 100 )

WHERE MyColumn BETWEEN 101 and 200

|||How am I supposed to "store" the day a folder was created in a field?|||

Well, somewhere, somehow, the folder was created. It was not created in SQL Server. SQL Server does not know anything about file folders UNLESS we tell give it a value and tell it to store the data.

So, unless your 'process' that creates the folders is smart enough to add that data to SQL Server, it will be left up to you to determine the creation date, and to add that creation date to a field in a table.

You haven't provided enough information to get the type of help that you are seeking. Perhaps if you were to provide a better description of what is happening and what you desire to accomplish, someone here 'may' be able to assist you.

No comments:

Post a Comment