Brent Ozar recently published a great blog-post covering the details of what you need to do: What to Do When DBCC CHECKDB Reports Corruption[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
You shouldn't change it at all. They are two separate facts, and should each be in their separate field. That way you don't need to "substring" on the name when the numbering changes, and can easily add another field if your combination is no longer unique. The database is not there to store "formatted" values, but data. Upon retrievel, you paste to two fields together and have what you want.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
Rather than using dynamic SQL and a cursor, why not use the undocumented sp_MSforeachtable procedure[^]?
ALTER PROC [dbo].[DATABASE_MAINTANANCE_PLAN]
AS
BEGIN
DECLARE @command nvarchar(max);
DECLARE @FillFactor int = 85;
SET @command = N'ALTER INDEX ALL ON \[?\] REBUILD WITH (FILLFACTOR = ' + Convert(nvarchar(3), @FillFactor) + N')';
EXEC sp\_MSforeachtable @command;
END
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
You are going to have a lot of problems getting support for vb6 controls, it is a dead language. You would be better served by scrapping the entire application and rewriting in a current language where you can get support.
Never underestimate the power of human stupidity RAH
Hi I would suggest you spend some time understanding Normalization of tables and reference integrity. If you have a good understanding of these concepts then it will be a lot easier for you designing the tables in the right way and fixing any errors.
I think you're looking for GROUP_CONCAT()[^]. As far as I understand it, you don't need the grouping aspect of it but there doesn't seem to be an equivalent function without it. So you need to provide the GROUP BY clause with a column whose value is equal for all rows whose item_name you want to concatenate. Pay attention to the remark about the maximum string length returned by the function in the linked documentation.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
I tried it using SSMS. I entered the IP address into SSMS and tried to connect. I've done it before. Not sure what's wrong now.
If it's not broken, fix it until it is
Don't you get the impression you may have done something incorrectly, the only response you have had is to fix your data structure. As Eddy said once yo have done that the query becomes trivial. It is possible to hack around the terrible structure you have built but us showing you for any reason is doing you a disservice. We are here to help you learn, help fix problems, we are not interested in perpetrating bad design.
Never underestimate the power of human stupidity RAH
Thank you very much Richard for ur prompt reply (I was away and hence was unable to see it right in-time then). Previously (some days ago), these were in-line functions but as records increase, an "Insufficient Memory" error was faced although systems had around 16, 32 GBs of Rams, due to which these have to be converted to multi-statement functions. Also, I m using SQL Server 2008 too but getting almost the same results. May u pls suggest some better way to write queries of these natures.
There are plenty of cross-platform webservers that run ASP.NET applications. Also, SQL Management Studio is a desktop application that manages SQL Server databases only, the applications have different purposes.
Learn C++ and database concepts. You are taking on a huge task.
There are only 10 types of people in the world, those who understand binary and those who don't.
MSDN[^] states:
By default, the maximum size that can be added to a captured column in a single INSERT, UPDATE, WRITETEXT, or UPDATETEXT statement is 65,536 bytes or 64 KB.
What is the size of your blob? Does it work with nvarchar(max)?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
You should be able to convert this to a single insert query with a correlated WHERE NOT EXISTS query, removing the loop entirely Something like this:
INSERT INTO destination_table (
id
,data_col_1
,data_col_2
)
SELECT id
,data_col_1
,data_col_2
FROM #tempdata TD
WHERE NOT EXISTS (
SELECT 1
FROM destination_table
WHERE id = TD.id
)
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================