Here's a few of the new posts today on the forums. To see more, visit the forums.
|
SQL Server 2017 - Development |
query CTE - Hi, I have a table with 2 fields DocumentID and ArrivedDate. I am able to elaborate only 2 documents in a day. How can I add a field (Final Date) with the correct days (every day with a max of 2 doc)? Thank you |
Temp table and table variable - DECLARE @command varchar(1000) SELECT @command = 'USE ? SELECT dbschemas.[name] as 'Schema', dbtables.[name] as 'Table', dbindexes.[name] as 'Index', indexstats.alloc_unit_type_desc, indexstats.avg_fragmentation_in_percent, indexstats.page_count FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id] INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id] INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id] […] |
SQL Job that takes too long - Hi, I am trying to send notifications to myself when a articular job that longer than 8 minutes to execute. For that , I have created JOB 2 ( Report Issue Job ) as shown below as a SQL AGENT JOB to send notification. Database configuration was setup and was also able to send myself […] |
Sql Statement to display multiple true statement - I have a sql statement that checks for certain special characters in a string and returns that. SELECT CASE WHEN (LEN(DSC1) - CHARINDEX(char(1), DSC1)) <> LEN(DSC1) THEN '[DSC1 - NUL (null)], ' WHEN (LEN(DSC1) - CHARINDEX(char(2), DSC1)) <> LEN(DSC1) THEN '[DSC1 - SOH (start of heading)], ' WHEN (LEN(DSC1) - CHARINDEX(char(3), DSC1)) <> LEN(DSC1) THEN […] |
SQL Server 2016 - Development and T-SQL |
Need help on Concatenate based on Group and Aggregate in SQL 2016 - ************* Got the solution ******************* Hi all, I hope and pray for everyone to be safe during this Covid-19 tough time. I need your help on "Concatenate based on Group and Aggregate in SQL 2016". I have found a possible solution in SQL 2017 using STRING_AGG( ) but my current sql sever version is SQL […] |
Development - SQL Server 2014 |
Link Server - Hello guys, I need of you help. I have 3 SQL server, srv1, srv2 and srv3. srv2 have 2 network card I hope you can help me. Thanks . |
SQL 2012 - General |
Sql server error randomly - we have sql jobs running in sql server 2012 environment and it has linked server to sql 2017 server environment. Randomly receiving the error below. Rerunning the job complete successfully and this is not reproducible consistently. Error Message: OLE DB provider "SQLNCLI11" for linked server "server ip" returned message "Client unable to establish connection". Msg […] |
SQL Server 2019 - Administration |
Have SA but unable to grant myself IMPERSONATE - I have sa permissions on server yet I'm unable to grant myself IMPERSONATE in any server database. --i tried GRANT IMPERSONATE ANY LOGIN TO [domain\myself]; GO --Getting Error: Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself. What do I need to do so that I can impersonate another […] |
SQL Server 2019 - Development |
Real columns are comma separated instead of dot separated ? - Hi, installed a new SQL Server Express 2019 and somehow my real columns are now with comma instead of the usual dot when separating number from decimals (viewed in SSMS). I never had this happen before. I installed the same SQL Express 2 weeks ago and it was fine. Does SQL Server now forces my […] |
SQL Server 2008 - General |
Get both Count and the data through single query to reduce time - My task includes: 1) Getting the count(which is nothing but the total number of records present in the specific SQL table.As they are millions of rows, it is taking a lot of time to run the count() query). I need to get the count before I write that data from data flow task(source) to the […] |
Reporting Services |
TableAdapter configuration wizard problem: no mapping exist - I'm getting this problem message when executing my SQL query: "Generated SELECT statement. 'No mapping exists from DbType Object to a known OdbcType." My SQL query: SELECT hencdiag.diagcode, hadmlog.hpercode, CONCAT(hperson.patlast, ', ', hperson.patfirst, ' ', hperson.patmiddle) AS name, hcity.ctyname AS district, haddr.ctycode, hadmlog.disdate FROM hadmlog INNER JOIN hperson ON hadmlog.hpercode=hperson.hpercode INNER JOIN haddr ON hadmlog.hpercode=haddr.hpercode […] |
SSRS 2016 |
Expand/Collapse action shows "+" instead of "-" - I want the level 0 expand/collapse icon to be "-". Apparently I've done this incorrectly; how do I fix it? Attachments show ToggleItem textbox, Group visibility expression, and Preview. |
Powershell |
create database if not exists - Good morning all I am looking to create a sql server database if the database does not exist on my instance I use this script for this Import-Module "SQLPS" -DisableNameChecking Import-Module -Name "${PSScriptRoot}\Module\logModule.psm1" -DisableNameChecking Add-Type -AssemblyName "Microsoft.SqlServer.Smo" $servers= 'DESKTOP-95KKMMH\PRODUCTION','DESKTOP-95KKMMH' $database='produit' foreach($server in $servers) { Set-Location SQLSERVER:\SQL\$server $db = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Database -Argumentlist $server, $database if($db […] |
Relational Theory |
Entity Relationship diagram - Path and Node entities - I have two tables; a path table that contains distinct paths and a node table that contains distinct nodes. A node can be present in one or more paths. A path is composed of one or more nodes (the path is composed of the id of the nodes concatenated by a dot). The image below […] |
COVID-19 Pandemic |
Daily Coping 20 Apr 2020 - Today's tip is to find positive stories in the news and share with others. A few things from me: https://voiceofthedba.com/2020/04/20/daily-copying-20-apr-2020/ |