Find when was last SP\CU was installed on SQL Server using T-SQL query or powershell - sql-server

I need to find when was last SP\CU was installed on SQL Server using T-SQL query or PowerShell.
Currently we can see it in
control panel--> installed updates
AND
C:\setupbootstrap\summary\logs
I have so many servers and I don't want to login to each server and need some query for the same. Is it possible? Thanks

Related

SQL Search for pgAdmin

I use SQL Search when working with SQL Server Management Studio and it works to find even comments written in sp. I would like to know if there is similar tool/function in Postgres/pgAdmin.

SQL Server Import/Export feature in Windows powershell

I am trying to perform some SQL Server related checks through PowerShell, pre and post SQL Server patching and one of the checks is to test if the SQL Server Import/Export functionality is working as expected post patching.
Note: this check is necessary to be verified so that SSRS works fine in my environment.
Hence please let me know if there is any way to implement SQL Server import/export functionality through PowerShell.

Is there some way I can update the statistics on my SQL Server 2012 database?

I don't have the management studio installed and cannot install the express version as there seems to be a problem with my computer set up.
However I have VS2013 and I can open up query windows.
I created Indexes but then since then I have added a lot of new data. Is there some way I can update statistics for my SQL Server 2012 database from the SQL Script command line?
Try EXEC SP_updatestats to update all database statistics.
You can access the SQL command line using the tool sqlcmd that is installed as part of SQL 2012.
Here's a link to the update statistics command that you'll need to put together and execute.
http://technet.microsoft.com/en-us/library/ms187348.aspx
You can always create a script for the update statistics command, then execute that.
If you have both SQL and SQL Express installed, please make sure that you are connecting to the correct instance of SQL Server. the machine name alone or localhost should take you to the full sql 2012, (the default instance name for this is MSSQLSERVER) and the SQL Express should have an instance name of SQLEXPRESS (if I remember correctly) you'll need to use the naming convention server\instance to make the connection (you probably knew this bit already)
Try this
EXEC sp_updatestats;
MSDN

How to batch database modifications from SQL Server Management Studio

I'm struggling to figure out how to batch modifications to our databases in SQL Server Management Studio. We'll perform actions like editing columns, creating tables, renaming tables, etc. that we need to perform on all of our environments - but not until we're ready to push the application. I'm trying to use the SQL profiler to grab the SQL but this seems horribly inefficient.
Is there a solution built into the application that will track such changes for me?
Looks like I found my answer: http://www.mssqltips.com/sqlservertip/1723/auto-generate-change-scripts-in-sql-server-management-studio-ssms-for-tables/
you can easily create scripts using the osql utility if you are on a version lower than SqlServer 2005.
From sql server 2005 onwards we use sqlcmd

How can i access to sql server from windows batch

I want to connect to Sql server and running some sql queries. How can i do that?
Thank you for helps..
Check out the SQLCMD utility:
http://msdn.microsoft.com/en-us/library/ms165702.aspx
Works not only on SQL Server 2008 Express, but also on the full versions, too.
You really need more detail in your question.
Based on my most common experiences, though, if you're just running some queries and putting the results somewhere, you'd want to create a SSIS (SQL 2k5 or 2k8) or DTS (SQL 2k5 and before) package and either have Windows schedule call the package or call it through your .bat file.

Resources