none
Visual Studio 2015 Sql Table

    Question

  • I am using visual studio 2015 and SQL server 2014. I created a service-based data base and i can't create two tables because i don't know how to change the table name. Please give a screen shot if you know how to change it.
    Saturday, May 14, 2016 11:58 AM

Answers

  • Hi MNI(sarath),

    If one or more of my answers were helpful for you please vote for them and mark them as an answer...

    Can you upload a screenshot or give us more information about what tab do you talk about... is it tab in SQL Server Management Studio or something else.

    If you were creating your tables in SQL Server Management Studio your tables are under: localhost (or some other name for your local instance of SQL Server) -> Databases -> YOUR_DATABASE -> Tables

    Hope this was helpful for you...

    Best regards!



    (If this was helpful for you, vote for it and propose it as an answer)


    • Edited by Almir Vuk Saturday, May 14, 2016 3:17 PM
    • Marked as answer by MNI(sarath) Saturday, May 14, 2016 4:23 PM
    Saturday, May 14, 2016 3:16 PM

All replies

  • Hi MNI(sarath),

    If you want to rename table name you can do it like this:

    sp_rename 'old_table_name', 'new_table _name';
    

    I'm not sure what exactly you want to achieve, in your question I concluded that you want to rename some of your tables in SQL. If you need more help please provide us more information about your issue.

    Hope this was helpful for you...

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)

    Saturday, May 14, 2016 12:24 PM
  • Its the tables in the section after I create a service-based database. After extending Database1.mdf the "Tables" comes it. I created two tables both has the name "dbo.Table". That is the thing I need to change. Without changing its showing errors.

    Saturday, May 14, 2016 12:33 PM
  • Hi MNI(sarath),

    Then you can execute SQL command on the table that you need to change its name, command that I wrote it early in this forum thread...

    Best regards!

    (If this was helpful for you, vote for it and propose it as an answer)

    Saturday, May 14, 2016 1:38 PM
  • Can you show me a screen shot or something of how to do it, if you can?

    Another thing is that I created one table and saved it, but when i opened the project again the table was not there

    Saturday, May 14, 2016 2:14 PM
  • Hi MNI(sarath),

    To rename your table you simply need to run new query from SQL Server Management Studio... 

    In SQL Management Studio choose New Query and than all you need is to run this command:

    USE YOUR_DATABASE_NAME_TO_EDIT
    GO
    
    sp_rename old_table_name, new_table _name;
    GO

    ... Caution: Changing any part of an object name could break scripts and stored procedures....

    Hope this make sense for you.. if is not I strongly recommend you to learn some of the basics for SQL Server and SQL in general.

    And again I hope this was helpful for you...

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)

    • Edited by Almir Vuk Saturday, May 14, 2016 2:35 PM
    Saturday, May 14, 2016 2:33 PM
  • Thanks for you help! I changed the table name and created all the tables I need, but when closing one tab I have to save them separately. When I try to find the created tables it doesn't shown and tables. What should I do?
    Saturday, May 14, 2016 2:46 PM
  • Hi MNI(sarath),

    If one or more of my answers were helpful for you please vote for them and mark them as an answer...

    Can you upload a screenshot or give us more information about what tab do you talk about... is it tab in SQL Server Management Studio or something else.

    If you were creating your tables in SQL Server Management Studio your tables are under: localhost (or some other name for your local instance of SQL Server) -> Databases -> YOUR_DATABASE -> Tables

    Hope this was helpful for you...

    Best regards!



    (If this was helpful for you, vote for it and propose it as an answer)


    • Edited by Almir Vuk Saturday, May 14, 2016 3:17 PM
    • Marked as answer by MNI(sarath) Saturday, May 14, 2016 4:23 PM
    Saturday, May 14, 2016 3:16 PM
  • Thank you for all you support!
    Saturday, May 14, 2016 4:25 PM
  • Hi MNI(sarath),

    You're welcome... MSDN forum community is here in order to help others.

    Best of luck with your learning.

    Best regards!

    (If this was helpful for you, vote for it and propose it as an answer)

    Saturday, May 14, 2016 4:34 PM