I am using Visual Studio Community 2019 and have a stored procedure on a database in SQL Server 2017. I have modified the procedure to change one of the JOINed tables to a different one and this reflects when I execute the stored procedure.
However, when I run a report using this procedure within Visual Studio, the old data appears. I have tried refreshing the fields in the dataset, as well as closing and opening the report and Visual Studio itself.
Is there some way for the report to pick up the change that I'm missing?
Thanks,
Rob
Related
I am a victim of the debugger having been removed in SSMS v18. You are now supposed to do it in Visual Studio 2019, but I am failing. I have read many webpages on the subject. For example:
Why aren't my breakpoints hitting SQL In Visual Studio 2019 debugging script from network server
How to: Debug a SQL Server CLR Integration stored procedure
How to debug SQL from Visual Studio 2019
What I try: here is the procedure:
CREATE PROCEDURE [dbo].[sp_DevTest]
AS
DECLARE #dHrs decimal(12,4)
SELECT #dHrs = dbo.TNPF_OperHours(592,'2020/10/31 23:59 -07:00')
RETURN #dHrs
Its purpose is to test function dbo.TNPF_OperHours.
I set a breakpoint on the SELECT statement. From the SQL main menu item I click on 'Execute With Debugger'. The entire procedure is highlighted in yellow; the breakpoint disappears. I cannot set a breakpoint. I press F11. The yellow highlighted procedure disappears and I am back at the editing window with the breakpoint highlighted.
I thought maybe I need a SQL project in the solution. After creating one I could not find a way of debugging from there.
My development environment is a single Win 10 computer with this SQL Server installation:
I use Visual Studio 2019 Community Edition. I develop websites for tiny non-profit organizations. I am retired and I donate my time. And I am stuck and would greatly appreciate your help.
Just install the latest SSMS v.17.9.1 that supports inline debugging.
It can coexist with SSMS 18.* on the same machine.
SSMS 17.9.1 download
I am working on SQL Database Project in the Visual Studio 2017. Purpose is to push only the Stored Procedure Changes to VSTS Git.
Instead of connecting to the Database from the Project Solution, I am using Import SQL Scripts.
In this approach, any changes in the stored procedure has to be copied and pasted on the stored procedure in the Project Solution.
How to set the SQL Database Project in the Visual Studio 2017 connected to the Database? And Connecting to the Database should not allow Import option to extract the all other database objects such as Table, View from SQL to Visual Studio. We do not want all other scripts. We just need only those Stored Procedures to be sync with database environment.
At present, we are making the changes to the Stored Procedures in the SQL Management Studio. Further then, we manually copy the SQL Script from SQL Management Studio to Visual Studio Environment.
Whether, will it be possible for us to have the changes auto-sync between SQL Management Studio to Visual Studio (or) by refreshing the Visual Studio Project.
In Visual Studio, go to Tools -> SQL Server -> Schema Compare. At the top of the new window, access the dropdown, and put your local DB connection (where you've added the stored procedure) on the left, and your DB project on the right. Hit Compare, and then Update. This should update the dbo directory in your Database project to match the local db schema, whether you're adding 1 proc or 100.
At this point, you'll also need to add a reference to the stored procedure to your database project in VS. Put the .sqlproj into a text editor, add the reference (there will be lots of examples to copy; it should be easy), save, and build the project to make sure you got it right. git add, commit, and push!
This only works if the schema of your local DB matches what is in the VS project. If you want to copy something from a database with a different schema, I think you're stuck copy-pasting.
AFAIK, there is no way to automate this, but I would love to be corrected about that. It would save me so much time at work. :)
Do you know where in SSMS 2014 can I set up my own shortcuts?
For example: in ORACLE SQL I set up that
sf = select * from
By this I only wrote in execution window sf and it wrote select * from.
Where and how can I set it in SSMS 2014?
Thank you.
SQL Server doesn't have shortcuts. SSMS is a separate product, based on the Visual Studio shell.
SSMS is a separate free product now, which supports all SQL Server versions from 2008 upwards (including SQL Server for Linux). The latest update came out on December 5. Updates are released regularly every month.
It has the same shortcut functionality as Visual Studio. You can change and define new shortcuts from Tools > Options > Environment > Keyboard
You can specify snippets in the Code Snippets Manager, Tools > Code Snippets Manager whose shortcut is Ctrl+K, Ctrl+B. You can insert a snippet by hitting Ctrl+K, Ctrl+X
There are several tutorials that explain how to use Code Snippets, eg Add T-SQL Snippets from the docs, Getting started with Code Snippets feature of SQL Server 2012, the similar SQL snippets in SQL Server Management Studio
It is a good idea to install the latest SSMS version. Now that it's a separate product, earlier versions won't get the same updates as the current one
I had SQL server management studio on my computer and I used to explore my company's database using it. When building queries it was very easy to right click on a table and 'select top 1000' rows. I would take that code then and modify it. This will save me time typing all field names for example.
Now I have MS Visual Studio and I can't install the Server Management Express. I can explore the database and I can right click on a table and view the records. However, I am not able to generate the select query automatically. How can I create these queries automatically and is there a way to visually design my sql query?
On Visual Studio, if you go tools -> Server Explorer and add a DB Connection, then you can mimic the management studio option to generate sql from db objects...
I just installed Visual Studio 2008 and SQL Server 2008 on my machine - in that order.
I note that VS insisted on installing SQL Server 2005 Express in order to be able to create a local database in by web projects.
In any case, whenever I add a local database and go to create a diagram, I can't seem to modify the Custom table view.
For example, I like to see the column name, data type, nullable and default value columns.
Whenever I click "Table View" - "Modify Custom", nothing happens!
Strangely, this action works fine in SQL Server 2008.
Has anyone else ever encountered this - and (hopefully) found a solution?