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.
| Author |
Topic |
|
tinamiller1
Yak Posting Veteran
78 Posts |
Posted - 2012-01-03 : 15:13:28
|
| I want to create a script so it does a create table but want to prmopt the user to enter a table name. This is in SQL Server. Example:script is as follows:create table database.dbo.test(lastname nvarchar(50),firstname nvarchar(50),address nvarchar(50),city nvarchar(50),state nvarchar(50),zip nvarchar(50),);This is just an example and NOT actual table info. Cannot provide that as it will violate HIPPA rules. I want the user to be prompted to enter a table name to create because right now there is an actual database name on the server and a dbo but if the users are not careful they will overwrite what is there. I do not want them to have to constantly change the line:create table database.dbo.test1 every time because they might mess up and overwrite.Right now the actual information is called databasename.dbo.claimsQ1Then I run the bcp to input into this table a gigantic file that houses all of the incoming claims for Q1. If users just run the script as is they will overwrite all the claims in claimsQ1 with the claims from Q2.I hope I am making sense. Right now the next upload the user would change that top line todatabasename.dbo.claimsQ2 and so on. But I am afraid they might overwrite prior stuff so the only thing I can figure is to comment the create table line out so they have to go in and change the end piece to claimsQ2 for the next go round.tina m milleredit: moved to correct forum |
|
|
tinamiller1
Yak Posting Veteran
78 Posts |
Posted - 2012-01-03 : 15:16:28
|
| I know in Access I can prompt for user input so just hoping that it works the same in SQL Server.tina m miller |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tinamiller1
Yak Posting Veteran
78 Posts |
Posted - 2012-01-03 : 15:35:49
|
| That is what I thought. I will just comment the first line out and then tell those that are using the script they have to change the table name and then taken comment fields out to ensure past tables are not over written.tina m miller |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|