Reputation: 13
I have written a C# program which uses a small table to get folder paths needed to read files and records based on customer. Now there is a need write to the remote and needs to use a different folder.
This app is going to an ecomm hub site and getting orders from stores that are parked there for us.
Currently the table is like this
[Id](PK,INT, not Null)
[FolderName] (nvarchar, max, not full)
[FilePath](nvarchar, max, not full)
[FolderNameAlias](nvarchar, max, not full)
Data is like this
Id FolderName FilePath FolderNameAlias
1 BESTBUY \\SERVER02\AR\IBS\DATA\ORDERS\BESTBUY\ BESTBUY
this FolderNameAlias
is where the path is to put the gotten records.
Now I want to add a folder where we put the ship confirm to this hub site. I want to know if adding one or 2 new columns, will I have to do anything in my current code which will not be using the new column until coded but is still in production?
Upvotes: 0
Views: 62
Reputation: 127563
As per your comments, as long as you are not using select *
and you are only reading or updating, never inserting, you should be able to add a new column without it breaking your old.
You could INSERT, but you must use explicit column naming and you must set default values or allow NULL for your new columns, for example
INSERT INTO YourTable (ID, FolderName, FilePath, FolderNameAlias)
VALUES (@ID, @FolderName, @FilePath, @FolderNameAlias)
As long as your new column has a default constraint associated with it or allows NULL the above insert will not break, however the below insert would break even with default values defined because SQL Server expects every column to be included for the insert if you don't specify the columns.
INSERT INTO YourTable VALUES (@ID, @FolderName, @FilePath, @FolderNameAlias)
Upvotes: 1
Reputation: 70523
The only way to know is to do an audit of the current code.
You need to check the current code if every select statement of the current code does not have wildcards but specifies the columns then those statements will work.
Insert statements will also work if they include a column list and you allow null values or a default value in the new columns you add.
Upvotes: 0