Multiple entity table design help
I'm facing some issue to work out a database design, its a very small database that stores data of Companies, their board members and shareholders. Initially I thought "ok, let us have an Individuals...
View ArticleIssue with deleting millions of rows of data
Hi all,A client I work with has a database that has been customised by a vendor, which is causing some serious performance issues. There are a group of 12 custom tables that are all "unrelated" - no...
View ArticleConversion failed converting to integer
[code language="sql"]SELECT CONVERT(VARCHAR(10), GETDATE()+2, 1) AS 'Date'unionSELECT DISTINCT User.id FROM User[/code]Msg 245, Level 16, State 1, Line 3Conversion fai
View ArticleSQL Agent can't run PowerShell Script - just hangs
I have an SSIS package that creates a .xlsx from a query result. I then need to insert a new row 1 above the column headers and value columns 1 and 2. Then schedule it via the Agent.I first did it...
View ArticleCreate a view to view encrypted columns from a table
Hello All,I have a table that has 5 encrypted columns. I'm using Symmetric Key for the encryption. Usually when I run the query I Open the Symmetric Key and then run my select statement. How do I...
View ArticleMemory-optimized tables and table-types
I have a very large stored procedure on my OLTP that runs multiple times concurrently based on user entries. The procedure was originally written with #TempTables for SQL Server 2008R2. We moved to...
View ArticleSearching T-Sql embedded in SSRS reports
Hi,Is there a way to search SQL script inside SSRS reports?One of our linked server name is changing. I do not know how many reports reference that linked server. Going into each repo
View ArticleAlter datatype in multiple colums
Hi All,We have 100 tables in our database and I need to modify one datatype from Text to VARCHAR(MAX). I need to write one script to affect whole database.I am tring to run below code but It did not...
View ArticleAlter colum datatype dynamically
Hi,I am trying to alter datatype from TEXT to VARCHAT for multiple table in same database and I have used below code but it did not work.Thanks a lot in advance.
View Articlestring or binary data will be truncated when using hashbytes
I'm running the below. , Why is it failing when I cast it as nvarchar(max) but not when I cast it as nvarchar(4000). This is one of about 60 columns I’m concatenating in my hashbytes. For some reason...
View ArticleIn manual commit mode, SQLEndTran() starts a new transaction
(Also posted on MSDN - I hope this is not considered cross posting - if it is, I apologize )Hi all,I have not posted in these forums before. Hope someone can help me - I could not find the answer to m
View ArticleOPENQUERY within CASE Statement - It may just be too much for TSQL
I'm looking for guidance. This is on a SQL 2014 server.I want to create a view that takes two columns, Domain00, and Account00, from one table and add a 3rd column, distinguishe
View ArticleAdd the identity to existing column
Hi all,Kindly suggest me , how we can add identity to the existing columnI had tried may ways from google but it's not working all the time I had rename and drop column or table but its not...
View Articlejoin two tables on Column where column has value specified more than once
I have two tables with below data table 1 Id name company 1 aaa yyy 1 aaa bbb table 2 Id designation 1 manager 1 manager When I join these on ID, I get 4 rows but instead I want to get two rows. target...
View ArticleCode not working in 2008/2005
The following code works fine in SQL 2014/2016 but gives me zero's in the counts (c) on older versions 2005/8. Any clues as what I might need to change?Thanks[code language="sql"]select top 1 t.
View ArticleSQL Agent job intermittently fails to execute SSIS package
I need some suggestions for troubleshooting this issue. I have the following setup: Application T-SQLI have SQL code in an application that executes a SQL Agent Job. (exec @rtn =...
View Articlehow to get total count from outer query cursor
I have a cursor where it has select queryselect col1,col2,col3 from table where col1 is not nullgroup bycol1,col2,col3I need a count of the query so that i can use it in inner query, How to get the...
View Articleupdate table column with value from another table
hello, I need some help trying to figure this one out.TableA id tablebidTableB idTableA has 4512 rows and TableB has 4512 rows. I need to update TableA.tablebid with TableB.id.I trie
View Articlerow size exceeds the maximum 8060
When we tried to access a table from .net code we get this error:An unhandled exception of type'System.Data.SqlClient.SqlException' occurred
View ArticleTrigger that sends email based on specific field value update
Hello,I am trying to create a trigger that will send out an email when a specific field value gets set to "Approved". Currently, my trigger is sending an email that anytime a field is updated in my...
View Article