Well, this is not some thing SQL Server has. This is a basic function you get in ORACLE or in mySQL.What it does.Let us look at this data set. It has Color and ProductNumber where ProductNumber is the business unique key,What I need is following output.In mySQL you can use simple function GROUP_CONCAT in Oracle you have LISTAGG functionSource :http://oracleabc.com/b/archives/2100In both cases it is one table scan which means cost is low,Let’s move to SQL Server.You don’t have a out-of-box function. However there is a workaround for this. Honestly I don’t know how this is working. and the query plan is,In case of SQL Server, you need to use DISTINCT and WHERE IS NOT NULL and more importantly there is two table scans, which means you might not use this for large tables. So has Microsoft SQL Server team has reserved this for future versions.
Popular posts from this blog
When linked server is created, following error is occurring. An error occurred during decryption.PN: Also, when configuring distribution for replication following error occurred.An error occurred during decryption.There is no remote user 'distributor_admin' mapped to local user '(null)' from the remote server 'repl_distributor'.Changed database context to 'master'. (Microsoft SQL Server, Error: 15466)This also due to unable to create linked server named repl_distributor.The Service Master Key is the root of the SQL Server encryption hierarchy. It is generated automatically the first time it is needed to encrypt another key. By default, the Service Master Key is encrypted using the Windows data protection API and using the local machine key. The Service Master Key can only be opened by the Windows service account under which it was created or by a principal with access to both the service account name and its password.Solution is to regenerate the servic…
I got this error in SSIS when I try to open Execute SQL Task. Then I tried to open already configured Execute SQL Task in some other SSIS packages. Still the error exists. I was wondering this is an error in SQL Server 2014 so I installed SQL Server 2012 and tried but it was no difference. So the work around is by clicking F4 and enter the configuration values in the Properties box.