Popular Posts
-
SQLServerCentral » Latest topics SQLServerAgent Error 22022 I have a sql agent job that runs every 5 minutes. It executes a stored ...
-
SQLServerCentral » Latest topics SQL server error “No catalog entry found for partition ID xxxxx in database 12…” SQL server error...
-
SQLServerCentral » Latest topics Simple Recovery Model and Checkpoint Good morning Experts, Checkpoint writes all dirty pages to di...
SQLblog.com - The SQL Server blog spot on the web
Sunday, December 31, 2017
An Introduction to PowerShell for a DBA
Saturday, December 30, 2017
using araylist in stored proc
but hier have a 2 column name and 2 values for this crud operaion
may be more columns and more values for crud opertaion
can i use ar
Friday, December 29, 2017
Free eBook: Troubleshooting SQL Server: A Guide for the Accidental DBA
Three SQL Server MVPs (Jonathan Kehayias, Ted Krueger and Gail Shaw) provide fascinating insight into the most common SQL Server problems, why they occur, and how they can be diagnosed using tools such as Performance Monitor, Dynamic Management Views and server-side tracing. The focus is on practical solutions for removing root causes of these problems, rather than "papering over the cracks".
Fantasy Football 2017
Thursday, December 28, 2017
Generate Create Login script for an Azure Logical SQL Server for DR purposes
I've done a fair bit of looking around, and I am not finding a way to generate a script that I can keep to recreate Azure SQL Server Logins (not users I've done that). I need something similar to the old sp_help_rev_login, but for Azure in
Understanding Migration from SQL Server to SQL Server 2017 using Data Migration Assistant
You can use the Data Migration Assistant (DMA) tool to migrate your SQL Server instance to an on-premise SQL Server 2017 or to Azure SQL Database. DMA analyzes data migration issues and provides recommendations to resolve them. Read on learn about the features of DMA and how DMA eases your SQL Server instance migration as well as reduces overall risks, allowing you to complete the migration successfully.
Splitting TempDB across multiple files
I have a question regarding the splitting of TempDB in SQL Server, I know its a must in production environments as DBs Start growing and system becomes move complex.
In terms of a System Test / UAT environments, Should the exact sam
Wednesday, December 27, 2017
Redgate data governance survey reveals database DevOps is the key to GDPR compliance
A major new data governance survey from Redgate demonstrates there are important GDPR compliance issues that need to be addressed – and that a DevOps approach to database development can provide the answers.
Two tables, exact same structure but with different names, behave differently while performing mass updates.
This has me stumped. I'm performing mass updates to a table. I'm using Data Masker by Redgate to de-identify the data. It's basically a wide update, involving 8+ columns. The table has around 662K+ rows. I have the constraints disab
Tuesday, December 26, 2017
Rethink Server Sizing
FCI + Always On
I want to setup a 3 nodes solutions. NODE_A, NODE_B and NODE_C are part of the same WSFC.
Node_A -> Contains the SQL Server Role, with the sql server clustered instance and its resources
Node_B-> SQL Server role can be fai
How to Customize Schema Comparisons using Auto Map in SQL Compare
SQL Compare includes many options to make comparing objects easier on the developer. Auto mapping is one of these, and if often saves a little time and frustration. However, there are times that you many need to customize your mapping, and this gives you a technique for doing so.
How to fix SQL Server disk I/O bottlenecks (without a hammer) In this new article, Simple-Talk editor Tony Davis explains step-by-step how to find and fix the root causes of disk I/O bottlenecks, including gathering data, avoiding knee-jerk fixes, and how monitoring tools can help. Read now. |
Monday, December 25, 2017
Changing the Path for the Master Database
We as DBAs, changing or migrating databases to a new path is important part of admin’s world. This article helps you with the steps involved to move the Critical 'master' database.
Fantasy Football 2017
Sunday, December 24, 2017
I don’t know how to help with database…
Saturday, December 23, 2017
Overriding error message sent back
I am using Entity Framework and message sent back to application if violation is encountered
[1234,5678 ] is d
Friday, December 22, 2017
VMs for Development
Stairway to SQL Server Agent - Level 3: Agent Alerts and Operators
How to be notified when a job succeeds or fails, or be notified when a SQL Server performance condition is met.
Thursday, December 21, 2017
ReSETting the value
Partition Level Locking: Explanations From Outer Space
Erik Darling partitions the Stack Overflow database, then uses sp_WhoIsActive's @get_locks = 1 parameter to demo locking.
RSTempFiles directory filling up our C: drive
Wednesday, December 20, 2017
Openrowset not working with network file path
I'm trying to get an openrowset query to work and I believe I'm running in the permission issues. I've looked around the internet extensively but haven't found a solution. The query works when referencing a file on the d
Checking SQL Server with Policy-Based Management
Policy-Based Management, a feature of SQL Server, is a flexible tool that can help DBAs manage one or more SQL Server instances. It's used for monitoring and enforcing a standard set of policies for SQL Server throughout an organization. While there are many built-in conditions from which to choose, Dennes demonstrates how to set up a custom policy as well as a standard one. Viewing the policy status over many servers can be tedious, so he also explains how DBAs can evaluate the states of multiple servers with just one glance.
Tuesday, December 19, 2017
Defining keys as sets that must not intersect instead of scalar values that must not be equal
Generating test data in JSON files using SQL Data Generator
SQL Data Generator is adept at filling SQL Server databases with ‘spoof’ data, for use during development and testing activities. However, what if instead of a SQL Server database full of fake data, you need a JSON file?
Multi-Source partitioned Azure Analysis Services tables – cold data from Azure Data Lake Store, hot data from Azure SQL Database
You can read this blog post at this link: https://jorgklein.com/2017/12/19/multi-source-partitioned-azure-analysis-services-tables-cold-data-from-azure-data-lake-store-hot-data-from-azure-sql-database/
This blog has moved to https://jorgklein.com There will be no further posts on sqlblog.com. Please update your feeds accordingly.
You can follow me on twitter: http://twitter.com/jorg__klein
Monday, December 18, 2017
Temporary tables and procedures
Free virtual event: SQL in the City Streamed
Technical sessions will dive into the latest Microsoft SQL Server releases, and cover topical issues such as data compliance, protection & privacy.
How to give month input in my procedure
I am creating one procedure to get Quarterly data from month input [code language="sql"]
alter procedure Ram_year_qu_month
(
@Fyear as varchar(20)
Sunday, December 17, 2017
Query big data, stored in a csv or parquet files, from any stored procedure
Every cloud provider these days have a serverless interactive query service that uses standard SQL for data analysis.
As for the biggest cloud providers, we have Azure Data Lake analytics, Google BigQuery and Amazon Athena.
Due to the fact that my company is using only Amazon cloud, I have some experience with Athena service and I must say that it is awesome.
I will show you today how you can use Management Studio or any stored procedure to query the data, stored in a csv file, located on S3 storage. I am using CSV file format as an example here, columnar PARQUET gives much better performance.
I am going to:
1. Put a simple CSV file on S3 storage
2. Create External table in Athena service over the data file bucket
3. Create linked server to Athena inside SQL Server
4. Use OPENQUERY to query the data.
Athena service is built on the top of Presto, distributed SQL engine and also uses Apache Hive to create, alter and drop tables. You can run ANSI SQL statements in the Athena query editor, launching it from the AWS web services UI. You can use complex joins, window functions and many other great SQL language features. Using Athena eliminates need for ETL because it projects your schema on the data files at the time of the query.
Let’s create database in Athena query editor.
As a next step I will put this csv file on S3. By the way, Athena supports JSON format, tsv, csv, PARQUET and AVRO formats.
Uploading the below file to S3 bucket (don’t put columns header in file):
Going back to Athena to create external table over the S3 folder. You can later add more files to the same folder and your queries will return the new data immidiately.
Now I can query the data:
As a next step I will set up a linked server from my SQL Server instance because I would like to offload the big data querying to Athena. Of course, I am using in this example tiny data file but in real life we are querying sometimes 300GB of data files in the single query and it takes a few seconds.
Athena has ODBC driver, I will install it on SQL Server machine ( AWS EC2 instance for this example).
Here is an installation link: https://s3.amazonaws.com/athena-downloads/drivers/ODBC/Windows/Simba+Athena+1.0+64-bit.msi
Setting up the ODBC connection. Important, click on the Authentication Option and fill in AccessKey and SecretKey that have permissions to access S3 bucket. S3 output location below will hold csv files with results from your queries. Remember to clean the output files from time to time.
What is left is to set up Linked Server inside Management Studio using OLEDB provider for ODBC.
EXEC master.dbo.sp_addlinkedserver @server = N'DWH_ATHENA', @srvproduct=N'', @provider=N'MSDASQL', @datasrc=N'DWH_ATHENA'
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'DWH_ATHENA',@useself=N'False',@locallogin=NULL,@rmtuser=N'*******',@rmtpassword='*********'
GO
Replace @rmtuser and @rmtpassword with AWS access key and secret key and now we can query the data files from any script or stored procedure.
There is one very important thing that you need to know. Regular SQL Server ODBC destinations querying behavior of is to send “select *” to linked server and do filtering inside SQL Server. This is very bad for us since we wanted to offload all work to Athena and we do not want to receive all data. The way to overcome this is to use OPENQUERY.
Here is example of the query that is using a linked server. The remote query has omitted all filtering and receiving ALL columns from the remote table and filter is being applied later on, inside the “Filter” step.
The same query that is using OPENQUERY instead of linked server:
Result.
Isn’t it wonderful to be able to keep the row data in files and query them with minimal effort from the SQL Server side?
Yours,
Maria
Is there any obvious performance difference between updating 1 column in a 4 column wide table vs 1 columns in a 1000 column wide table ?
I have another table with 100 columns and 10 million rows in which again, I want to update 1 column.
Which one among these 2 would perform better.
Saturday, December 16, 2017
Replace TABLE with STAGING_TABLE. Approach?
At the end of the procedure I want to replace a CLIENTS table with the CLIENTS_STAGING table.
This process happens a number of times per day and the CLIENTS table needs to be available as much
Friday, December 15, 2017
Selectivity vs SARGAbility?
What is the difference between Selectivity and SARGAbility?
Thanks,
Sam
So long, farewell, auf Wiedersehen, adieu
Major new study reveals the true ROI of database DevOps
Redgate has launched a new research study that reveals the benefits different stakeholders can expect from DevOps, and provides a powerful methodology for calculating the ROI of database DevOps.
Help with SQL memory pressure investigation
Please help me with SQL memory pressure investigation.
1 month ago we upgraded from SQL2005 (on WindowsServer2008) to SQL2016 (on WindowsServer2016).
Since that moment we had few serious incidents caused by memory pressure.
How
Thursday, December 14, 2017
error while importing Data from SQL server into tabular cube in Visual Studio
I am importing Data from SQL server into tabular cube in Visual Studio solution using table import wizard , Test Connection is successful but once I check mark source table and click finish it gives me err
Correlation Analysis using Correlation Plot in Power BI Desktop
Power BI provides correlation plot visualization in the Power BI Visuals Gallery to create Correlation Plots for correlation analysis. In this post, Siddharth Mehta shows how to create a correlation plot in Power BI Desktop using a sample dataset of car performance.
How to fix SQL Server disk I/O bottlenecks (without a hammer) In this new article, Simple-Talk editor Tony Davis explains step-by-step how to find and fix the root causes of disk I/O bottlenecks, including gathering data, avoiding knee-jerk fixes, and how monitoring tools can help. Read now. |
Wednesday, December 13, 2017
Introducing the updated HTML comparison report in SQL Compare 13.1
In SQL Compare 13.1, Redgate have updated the interactive HTML comparison report type, providing simpler cleaner reports that focus on the differences between the compared databases. This blog post looks at the details of what's new.
Today's Random Word!
Tuesday, December 12, 2017
It's Time for SQL in the City
Workaround for SQL Server 2017 PolyBase Installer Bug
Intellisense broken?
Up until about a week ago, Intellisense on my SSMS worked fine. Now it's still working but for some reason only brings up SQL System functions. It doesn't prompt me for table names / columns / aliases anymore. Not even system tables. Like when I'm
Importing JSON Data from Web Services and Applications into SQL Server
To support many applications, it makes sense for the database to work with JSON data, because it is the built-in way for a JavaScript or TypeScript application to represent object data. It can mean less network traffic, looser coupling, and less need for the application developer to require full access to the base tables of the database. However, it means that the database must do plenty of checks first before importing. Phil Factor explains how it can be easily done.
Monday, December 11, 2017
Retrieving sales from last month
I just want to find out how to retrieve total sales for the previous month.
For example, if i pull the report for Decemb
Comic for December 07, 2017
query help
DROP TABLE #tStudents
CREATE TABLE #tStudents(
[StudentID] [varchar] (6) NOT NULL ,
[StudentName
http://www.healthyapplechat.com/vital-force-enduromax-reviews/
Singular or Plural
STRING_SPLIT with no delimiter
Is This Database Being Used?
SSRS - Inherited Server - Unable to find instance - Is it possible to repair?
On the SQL 2016 Server I am a "DBA" of now, I was looking to setting up SSRS. At first glance it looks like it is installed, but when I try to browse to http://localhost/reports no page comes up
Fantasy Football 2017
Populate Acct Number (based on record above)
An Open Letter to the SQL Community: Requests of Speakers
STRING_SPLIT with no delimiter
Delayed gratification or not?
Retrieving sales from last month
I just want to find out how to retrieve total sales for the previous month.
For example, if i pull the report for Decemb
Please help with xp_cmdshell
When this is run I get the following error:
Th
Intellisense broken?
Up until about a week ago, Intellisense on my SSMS worked fine. Now it's still working but for some reason only brings up SQL System functions. It doesn't prompt me for table names / columns / aliases anymore. Not even system tables. Like when I'm
Singular or Plural
Monitor spids on SQL Azure instance? Can we do it?
Can I do the below for SQL Azure instance/db?
Suppose, I want to take a look at what is running right now . For example I want to run sp-who2 or execute sys.dm_exec_requests or sp_whoisactive to see if there is a blocking or wan
Copying rows from AS400 table into SQL table based on a sequence field.
Stock take FiFo conundrum
Hello,
I'd very much appreciate some advice/help with a stock take problem.
I've had a look at https://ask.sqlservercentral.com/questions/1
Retrieving revenue total for last day of previous month
Im trying to retrive total revenue last day of previous month, i can get all the months totals, however i cant get my head around only retrieving the total revenue for last day of previous month.
This will be my opening balance
I
Delayed gratification or not?
Even More SQL Server Features that Time Forgot
SQL Server works well, and Microsoft does everything it can to keep it relevant and competitive: As with everything in real life, it doesn't don't always get it completely right, and Rob Sheldon continues his quest through the jungle of past features to rediscover and explore the ones that time forgot. Here, he comes across Lightweight Pooling, XML Indexes, Stretch Databases, SQL Variants, Transaction Savepoints and In-Memory OLTP.
Sunday, December 10, 2017
dm_os_process_memory shows more memory usage than dm_os_memory_clerks & dm_os_buffer_descriptors
I'm looking for some help finding some missing memory and how to reclaim it without restarting the SQL service.
The original issue:
A SSIS package is hanging on a sort operation. Only ~860K rows, ~45 bytes per row = ~37 MB.
This
Powershell experts, I need help with dynamic parameters. Posh V5. First Param Determines list of choices in next param.
I am really trying to get my head around dynamic parameters, but I just dont know enough PS to get this right. I'd like to select an environment from a drop down (validateset, no issues here), but then I'd like a related list to become ava
Which OS for SQL Server 2017 Standard? (new data warehouse)
Delayed gratification or not?
metrics
Find and count Incomplete records in a table
Help with Trigger emial
I have managed to g
Scripting Tables with ALTER with dependencies
Please advise how I can script all the tables of a database with ALTER option . It should script the drop and create of the dependencies like Indices, Constraints .Thanks in advance.
adding 365 partitions to existing scheme and fucntion in sql server 2014
My tables are partitioned on business date. My requirement is to add 365 partitions for next year to existing partition function and scheme.
Can Data Save the World?
Monitor spids on SQL Azure instance? Can we do it?
Can I do the below for SQL Azure instance/db?
Suppose, I want to take a look at what is running right now . For example I want to run sp-who2 or execute sys.dm_exec_requests or sp_whoisactive to see if there is a blocking or wan
How to delete data in child tables first and then parent table data?
Looking for a TSQL script which can delete/truncate data from child tables first and then parent tables. Does anyone has an handy script to do DELETE's ??
Thanks,
Sam
Singular or Plural
Can we restore copy-only full backup and regular tlog backup?
Can we restore copy-only full backup and regular tlog backup?
adding 365 partitions to existing scheme and fucntion in sql server 2014
My tables are partitioned on business date. My requirement is to add 365 partitions for next year to existing partition function and scheme.
"Tag" highest value in the month
How can I create a third column the will place a
Saturday, December 9, 2017
joining lots and lots of tables in a vew
have got a query(view) that needs to join multiple tables in a view. Currently have over 100 tables in the join - and this number could get larger. Does produce is a rather wide resultset (1 column per table)
joined tables are relatively small (c
Changing sys.configurations for SQL Azure instance? Is that possible?
If I would like to change the sp_configure settings on a SQL Azure instance, how can I do that? Can we do that using tsql statement or something which has to done in azure portal? This is a testing server. I want to propose changing "cost
Link SQL Server 2014 to a Progress Database, is it possible?
i was tasked with a weird question, and sorta told them it is possible, or could be, but, is it really possible to link a Sql server 2014 to a Progress Database?
what the main goal is to replicate data daily from Progress
Cache Report via SQL commands
I'd like to cache a few reports at the same time using a SQL statement.
Currently I have to go to each SSRS report-->Manage-->Caching-->Click "Create a cache snapshot when I click Apply on this page" --> Apply
I am looking
Query from 2 tables from 2 databases
below is my query, the query result is2 columns from2 different databases
the columns "OriginalPremium" & "Share"
Share is always staticin EACH query run but in some queries are 50 some are 60..etc
the que
ORDER By Based on Company then SubCompany
Trying to create a selection in a specific order.
The table is like this
CompanyName , CompanyStatus, CompanyNumber, GroupNumber
Blackwell , group, &nb
Query from 2 tables from 2 databases
below is my query, the query result is2 columns from2 different databases
the columns "OriginalPremium" & "Share"
Share is always staticin EACH query run but in some queries are 50 some are 60..etc
the que
Can Data Save the World?
Property IsMailHost is not available for Database [msdb]
Scripting Tables with ALTER with dependencies
Please advise how I can script all the tables of a database with ALTER option . It should script the drop and create of the dependencies like Indices, Constraints .Thanks in advance.
Today's Random Word!
Friday, December 8, 2017
"Tag" highest value in the month
How can I create a third column the will place a
http://www.healthyapplechat.com/ultralast-xxl-reviews/
Can Data Save the World?
HASHBYTES can help quickly load a Data Warehouse
Are the posted questions getting worse?
Singular or Plural
Today's Random Word!
The Relational Database is the Default
application_name is not available in audit logs in SQL Server 2017
Singular or Plural
Can Data Save the World?
Job getting stuck in UAT but runs fine in Prod
dm_os_process_memory shows more memory usage than dm_os_memory_clerks & dm_os_buffer_descriptors
I'm looking for some help finding some missing memory and how to reclaim it without restarting the SQL service.
The original issue:
A SSIS package is hanging on a sort operation. Only ~860K rows, ~45 bytes per row = ~37 MB.
This
Remove duplicate values
In the below table records are grouped by ID column. If the count for ID is greater than 1 then remove the records which are having 'Null" values in any of the name ,city ,
The Relational Database is the Default
Singular or Plural
Thursday, December 7, 2017
Linked Server Error
I am trying to export the SQL (Server 2012) data to Excel file. I tried the below query
INSERT INTO OPENROWSET
Stairway to DAX and Power BI - Level 12: Function / Iterator Function Pairs: The DAX CountA() and CountAX() Functions
Business Intelligence Architect, Analysis Services Maestro, eight-year Microsoft Data Platform MVP and author Bill Pearson introduces the DAX CountA() and CountAX() functions, discussing the syntax, uses and operation of each. He then provides hands-on exposure to CountA() and CountAX(), in counting non-empty cells in a column, and in counting nonblank results when evaluating the result of an expression over a table, respectively.
Remove duplicate values
In the below table records are grouped by ID column. If the count for ID is greater than 1 then remove the records which are having 'Null" values in any of the name ,city ,
Logic to check for empty table before joining
I have a requirement which requires me to display report as per the dimension access to the user trying to pull the report. Just to give an example.. My dimension "Dimension.Sites" can have more than 20 sites. But a us