Transact SQL :: Verify Complete Restore Path (check For Missing Files)

Jul 29, 2015

In SQL Studio, I can go to the restore window and the click "verify backup media". This would check the restore plan listed in this window and check if some of the file are missed.Is there any way to reach this with TQSL? I know there is a "restore verify" command, but this will only verify one backup/file and not the complete restore path. I'm looking for a TSQL solution which is able to control that all necessary backup files are still present on the file System and not moved or deleted (e.g through cleanup task).

View 3 Replies


ADVERTISEMENT

Transact SQL :: Check If UNC Path Exists (It Is Folder Not File)

Oct 29, 2015

Usual way to check if file exists

DECLARE @File_Exists INT 
EXEC Master.dbo.xp_fileexist 'serverBSQL_Backupfile.bak', @File_Exists OUT 
print @File_Exists

1

And if check folder, can use "nul", but it doesn't work for UNC path

DECLARE @File_Exists INT 
EXEC Master.dbo.xp_fileexist 'serverBSQL_Backup
ul', @File_Exists OUT 

print @File_Exists
0

If use xp_subdirs like:

 EXEC master.dbo.xp_subdirs 'serverBSQL_Backups'

If the folder doesn't exists,

Msg 22006, Level 16, State 1, Line 3
xp_subdirs could not access 'ServerBSQL_Backups*.*': FindFirstFile() returned error 67, 'The network name cannot be found.'

How to check if UNC folder exists in Backup? in my code I want to check if the unc folder exists before doing backup, the unc path is retrieved from other table or backup history.

View 8 Replies View Related

Transact SQL :: Check If There Are Files In Folder

Jul 20, 2015

I'm wondering if its possible to return the number of files in a folder suing something like DIR command.I'm wanting to do something like, If count(DIR) >0 then do something

else End
exec master.dbo.xp_cmdshell
'dir C:Test'

View 2 Replies View Related

Recursive Complete Path On SQL SERVER 2005 ???

Apr 18, 2008

Dear,

I'm having this table:

PathIDParentPathIDPath
1 NULL D:
2 1 Sections
3 2 Bin
4 3 Data
5 4 FinancialReport.doc
6 4 DebtReport.doc
7 3 db.dll

I would like to create a store procedures that will return me a full path by passing a PathID

I started with this code:

DECLARE @path_id int
SET @path_id = 5;
WITH fullPath (PathID, ParentPathID, Path)
AS
(
SELECT PathID, ParentPathID, Path
FROM tblPath WHERE PathID = @path_id
UNION ALL
SELECT tblPath.PathID, tblPath.ParentPathID, tblPath.Path AS Path
FROM tblPath
JOIN fullPath ON tblPath.PathID = fullPath.ParentPathID
)
SELECT * FROM fullPath

This code will return this:
1 NULL D:
2 1 Sections
3 2 Bin
4 3 Data
5 4 FinancialReport.doc

What I would like to get is something like this:
D:/Sections/Bin/Data/FinancialReport.doc

Any help would be really appreciated. Lost too much time on it already.
Thanks,
pharvey

View 9 Replies View Related

How To Check/verify SQL Login Credential

Nov 15, 2007

Hi, I am making a module to backup SQL Db from webpage. I impersonate asp.net user to a given Windows Account and need to verify that account has required permission in SQL Server.I don't know how to verify the windows account credential for SQL Server login. Now what I am doing is to run SQL query against database to select row from some table, if it is successful, the user is valid SQL login. But I know it's not the way. Any idea? Thanks, 

View 1 Replies View Related

Using SqlCeEngine To Verify/Restore A Database

Jul 31, 2006

I have a compact pc program that uses a sql server database (sdf file).
I want to check the database integrity when program starts so I added a call to veriy method of SqlCeEngine

string dbFullName = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "NessDB.sdf";
SqlCeEngine engine = new SqlCeEngine("Data Source = " + dbFullName);
engine.Verify();

The call to verify always returning false and when I call repair

string dbFullName = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "NessDB.sdf";
SqlCeEngine engine = new SqlCeEngine("Data Source = " + dbFullName);
engine.Repair(null, RepairOption.RecoverCorruptedRows);

the program crashes and I get an exception "The specified module could not be found"
Why this happen and how can I check database corruption.

View 7 Replies View Related

How To Verify The Validity Of A File Prior To Attempting Restore?

Mar 22, 2007

Hello,

I would like a way to check a file before attempting to restore it. I want to be able to tell that this is a valid SQL backup file and not just some random file before I attempt a restore.

Any help would be appreciated!

hassiah

View 5 Replies View Related

How To Verify The Integrity Of A Back-up File Prior To Restore?

Mar 22, 2007

Hello,

I have some C# (.NET 2.0) code that performs back-ups and also can perform restores of back-up files. I would like to validate the integrity of a file prior to initiating a restore operation. In other words, I want to know, before I try to restore, if the file is just a random file (picture, work doc, zipped backup, etc.) or if it is a valid SQL backup file.

Any help would be greatly appreciated.

Thanks,

hassiah

View 3 Replies View Related

Sched. Db Restore Task Won't Complete Due To Db Being In Use.

Oct 27, 1999

"Database in use. The system administrator must have exclusive use of the database to run the restore operation." I created a script in the 7.0 database to reconfig the db to 'dbo use only' and identify and then kill all but the 'SA' and 'NT AUTHORITYSYSTEM' processes but that still is not enough. Can anyone please tell me what I'm missing here?
Thanx.
W.

View 1 Replies View Related

Restore A Complete SQL Server Installation Into A New Clean One

Oct 13, 1998

A customer is about to replace their PDC with SQL Server running on it.
MY companies role is to build the new server, and get their SQL Server running again.
I need to have the devices, databases, tables, data and the USERS copied across. I cannot use transfer manager as their will be only 1 instance of SQL Server running on the network.

If all we have is an NT backup is perfomed on the entire disk, i.e. the MSSQL/DATA directory.
How do we recreate the databases and their associated tables and also, how do we recreate the User accounts ?
Any ideas would be appreciated.

Please feel free to e-mail me with a response
NEILA@ANGLIABC.CO.UK

TIA

View 4 Replies View Related

Transact SQL :: Instead Of Insert / Verify Not Inserting Into Identity Column

Apr 24, 2015

I am writing an Instead of Insert trigger. I would like to fire an error when inserting into an 'Identity' column. Since UPDATE([ColumnName]) always returns TRUE for insert statements, is there an easy/fast way around this? I don't want to use: 

IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NULL))
here is my pseudo-code...
CREATE VIEW [org].[Assets]
WITH SCHEMABINDING

[Code] .....

-- How does this statement need to be written to throw the error?
--UPDATE([AS_ID]) always returns TRUE

IF(UPDATE([AS_ID]))
RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;

-- Is there a faster/better method than this?
IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NOT NULL))
RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;

-- Do Stuff
END;

-- Should error for inserting into [AS_ID] field (which is an identity field)
INSERT INTO [org].[Assets]([AS_ID], [Tag], [Name])
VALUES(1, 'f451', 'Paper burns'),
(2, 'k505.928', 'Paper burns in Chemistry');

-- No error should occur
INSERT INTO [org].[Assets]([Tag], [Name])
VALUES('f451', 'Paper burns'),
('k505.928', 'Paper burns in Chemistry');

View 7 Replies View Related

A Previous Restore Operation Was Interrupted And Did Not Complete Processing On File

Sep 6, 2007



Hi

I am new to Forum. So not sure if i am posting my problem uner the right topic.

We have a sql server 2005 enterprise edition 4 way cluster on windows 2003 advance server.

I am logshipping these database to a different server at a different location.
My logshipping went fine until one the cluster server failed and the server instance failed over to another node.
The backup that happened around that time got copied over to the secondary by the copy job.
The log file that got copied to the secondary server tried restoring and i think it failed int he middle of restoring it.
(You would think that the sql would knoe if the backup is in complete and will move on to the next file. Not sure what happened there.)
There is no indication of the *.TUF file in the directory where i have the log files.

I tried restoring it manually and i got the following error

Msg 4319, Level 16, State 3, Line 1

A previous restore operation was interrupted and did not complete processing on file 'sessionlog1'. Either restore the backup set that was interrupted or restart the restore sequence.

Msg 3013, Level 16, State 1, Line 1

RESTORE LOG is terminating abnormally.


I looked in the msdb..log_shipping_secondary_databases and looked for the last file that it restored and tried restoring it again with the following restore command by removing and adding some of the keywords that you see after the "WITH" clause.
MSFT do not recommand to use continne_after_error unless its absolutley necessary. I stilll get the above error.


restore log sessiondata

from disk = 'I:sql13qasmlogssessiondatasessiondata_20070901124516.trn'

with restart, CONTINUE_AFTER_ERROR, norecovery

When i add the restart int he with clause,


The restart-checkpoint file 'J:Microsoft SQL ServerMSSQL.5MSSQLBackupsessiondata.CKP' was not found. The RESTORE command will continue from the beginning as if RESTART had not been specified.

Msg 4319, Level 16, State 1, Line 1

A previous restore operation was interrupted and did not complete processing on file 'sessionlog1'. Either restore the backup set that was interrupted or restart the restore sequence.

Msg 3013, Level 16, State 1, Line 1

RESTORE LOG is terminating abnormally.

I checked it the backup directory and i can't locate the .CKP file.

Does anyone ever come accross this issue?

Is there anyother way i could recover this DB in a standby or norecovery mode.

Any kind of help to resolve this issue (beside copy the full backup and redo the whole log-shipping process again) would be appreciated. sicne my primary and secondary server are totally ina different location, i need to ship a tape, if i need a full backup. This is the 3rd time its happening on that cluster. its frustrating to ship a tape everytime this happens.








View 4 Replies View Related

Transact SQL :: Notification When A Group Of Jobs Complete

Apr 23, 2015

I have a large number of jobs that I run using a cursor (All jobs start with PS_ and each job loads a single table from ORACLE) so they can run in parallel.  I want to be able to be notified when the last job completes.  Should this done using a trigger?  Or should I just add a loop statement to the stored procedure that fires this job?  I know which individual takes the longest and I could simply just add a notification to send email on success but I want it to be more robust.  Below is what I am using to trigger the jobs.

BEGIN
SET NOCOUNT ON;
DECLARE @year CHAR(4)
DECLARE @month CHAR(2)
DECLARE @day CHAR(2)
SET @year = CAST(DATEPART(YEAR, GETDATE()) AS VARCHAR)

[Code] .....

View 6 Replies View Related

Backup Master Key, Cannot Write Into File 'c: Empmaster'. Verify That You Have Write Permissions, That The File Path Is Valid.

Jul 12, 2006

Hi,



I tried to backup the master key by the following syntax :

OPEN MASTER KEY DECRYPTION BY PASSWORD = 'mypassword'

BACKUP MASTER KEY TO FILE = 'c: empmaster' ENCRYPTION BY PASSWORD = 'mypassword'

but it failed and i got the following message:

Cannot write into file 'c: empmaster'. Verify that you have write permissions, that the file path is valid, and that the file does not already exist.

NB: I am using the "sa" user to execute this command.

I know that we have a security permission issue , but where and how ?



Regards,

Tarek Ghazali

SQL Server MVP

View 12 Replies View Related

SQL Server 2008 :: How To Check A Path Existing

Apr 29, 2015

whenever I use the below script, it throws the below error.

declare @DbFilePath VARCHAR(max)
set @DbFilePath = ' c:mdndndmmnsn'
if object_id('tempdb.dbo.#fileExist') is not null
drop table #fileExist

[Code] ....

Msg 0, Level 11, State 0, Line 0 A severe error occurred on the current command. The results, if any, should be discarded.

View 2 Replies View Related

Restore Log Looking For Log Path...

May 10, 2007

I am having difficulty restoring a database (DB_1) consists of 2 datafiles and one log file, DB Structure is as following:

Filegroup PRIMARY with file name 'fnm_data' with physical file name and location D:dbfile_1.mdf,
Filegroup 'FG1' with file name 'fgnm1_data1' with physical file name and location F:dbfile_FG1.mdf,
One log file with file name 'fnm_log' with physical file name and location (E:loglog_db.ldf)

{Note} Logfile resides on E drive whereas Datafiles reside on several other drives.

I need to restore the DB on another machine. And I need to move the log file to a drive other than E.In this case it is K drive. Hence I have used the following code,

restore log DB_1 from disk='M:kupccciclog.txt'

WITH RESTRICTED_USER , MOVE 'fnm_log'

TO 'K:DBlog_db.ldf', recovery, replace,RESTART

go


When I try to restore from backup files, I keep error message saying "Physical file name E:loglog_db.ldf may be incorrect." 'fnm_log' cannot be restored. Use Move command to identify a valid location for the file.

Even though I am using Move command to move the log file.


Then I found that if I create a drive with E: and a folder named 'log' then restore program runs alright. That is, when E:log exists then code does run smoothly. All the restore code is looking for the presence of path of the log file from where it is been backed up. In this case it is E:log folder. Once the database is restored I could kill that directory and nothing happens. Also log file has been restored on K:DB only.

Why the restore code is looking for the initial drive letter and path even though I have used Move command? Is there an issue in my code?

Any help will be highly appreciated.

View 8 Replies View Related

Unable To Specify UNC Path For Restore Through GUI??

Feb 24, 2007

Hi,After just installing sql 2005 on our test machine, I am trying torestore a database using a backup file on the network. However, thespecify backup diagol box allows only for browsing to a file on thelocal machine - I find no way to type a UNC path to choose the backupfile from. I can do this in 2000, is it no longer an option to doitthrough the GUI or am I missing something?ThanksKR

View 1 Replies View Related

RESTORE LOG With Different Recovery Path

Nov 15, 2006

I'm trying to RESTORE LOG with a different recovery path. Is there a way to do this? I'm getting the below error. I know I could RESTORE from the beginning, but need to RESTORE the log file to the same database schema but different database and server. What steps do I need to do?

This backup set cannot be applied because it is on a recovery path that is inconsistent with the database. The recovery path is the sequence of data and log backups that have brought the database to a particular recovery point. Find a compatible backup to restore, or restore the rest of the database to match a recovery point within this backup set, which will restore the database to a different point in time. For more information about recovery paths, see SQL Server Books Online.

View 5 Replies View Related

SQL Server Admin 2014 :: Check If UNC Path Exists (It Is Folder - Not File)

Oct 29, 2015

usual way to check if file exists

DECLARE @File_Exists INT
EXEC Master.dbo.xp_fileexist 'serverBSQL_Backupfile.bak', @File_Exists OUT
print @File_Exists
1

And if check folder, can use "nul", but it doesn't work for UNC path

DECLARE @File_Exists INT
EXEC Master.dbo.xp_fileexist 'serverBSQL_Backupul', @File_Exists OUT
print @File_Exists
0

If use xp_subdirs like:

EXEC master.dbo.xp_subdirs 'serverBSQL_Backups'

If the folder doesn't exists, Msg 22006, Level 16, State 1, Line 3 xp_subdirs could not access 'ServerBSQL_Backups*.*': FindFirstFile() returned error 67, 'The network name cannot be found.'

how to check if UNC folder exists in Backup? in my code I want to check if the unc folder exists before doing backup, the unc path is retrieved from other table or backup history.

View 6 Replies View Related

Transact SQL :: Backup / Restore Tools Which Can Restore Multiple Environments

Jun 25, 2015

I am looking for a SQL Backup/Restore tools which can restore multiple environments.  Here is high level requirements.

1.  We have 4 DBs, range from 1 TB - 1.5 TB Each Database.  When we restore to QA, DEV, or Staging, we usually restore 4 of them.
2.  I am looking for the speed to complete restoring between 1 - 2 hours for 4 DBs.

I am evaluating the Dephix Software but the setup is very complex and its given us a lot of issues with Windows Authentions, and failure in the middle of the backup.  I used Guess Software many years ago but can't find it on the web site any more. Speed is very important for us mean complete restoring as fast as possible.  We are on SQL 2012 and SQL 2008 R2.We are currently using NETAPP Technology and I have Redgate Backup Tool but I am mainly looking for fast Restore Process.

View 4 Replies View Related

Restore A Backup Into A New Database With Different Path On The Devices

Mar 11, 1999

Hi, I've to restore a bk into a new DB, because the old one has a lot of devices created on different places and phisical disks.
Im not sure to do that, cause Ive heard some problems with this action.

The old Db has 10 devices of data and 10 devices of log, and I want to create only one device of data (sum of all the data devices) and only one device of log (sum of all log devices)
Is it possible or not?

Tnx a lot!

View 2 Replies View Related

Restore Failed - The Path H: Has Invalid Attributes

Jul 5, 2007

Hi

Hopefully someone can help me.

I'm trying to restore my DB to a new server and also a new instance of SQL 2005 SP2+ hotfix KB934458.

I've successfully restored my MSDB database and everything seems to be working fine, but now when I'm trying to do a restore of my Database RMc to the attached SAN,



I'm getting the error:



System.Data.SqlClient.SqlError: The path 'H:' has invalid attributes. It needs to be a directory. It must not be hidden, read-only, or on a removable drive. (Microsoft.SqlServer.Smo)



the H: is the Drive letter for my attached SAN.

The path I'm trying to give is H:\DBData for the MDF-file and the H:DBLog for the LDF-file.



I have the DB running on another server also with a SAN attached and there are no problems.



I also moved the MSDB to another drive on the SAN - a G-drive without any problems.



Is there someone who have a good idea?



TSloth :-)

View 3 Replies View Related

Path To Configuration Files

Jan 22, 2007

Can someone tell me why path to the configuration file couldn't be relative to the package? When I try to use relative path (i.e. do not specify full path to the configuration file) package then run from BIDS looks for configuration file in the solution folder instead of package's folder (project folder).

Is there ane way to force package use same folder to search for caonfiguration files?

Thanks

View 6 Replies View Related

Check For Missing Identity Numbers

Sep 26, 2007

Is there a way to check for missing identity numbers in a Primary Key column? I have some databases that are not fully normalized and want to check on tables that might have had some records deleted. Thank you.

View 3 Replies View Related

Changing Path Of Data && Log Files On The Fly

Dec 4, 2004

We have a SQL Server setup as a publisher to 15 subscribers. We need to change the path of the data & log files to a new drive (added a new harddisk). We plan to take a cold backup of the database and shift the data & log files to the new drive. Then we just attach the data & log files from the new path.

Will this disturb my existing replication Setup?
Is the the correct procedure for changing the path of the existing data & log files?
What is the appropriate method for shifting data & log file of a live database to a different location (directory/drive) ?

thanks in advance

View 2 Replies View Related

Dynamic Path To Excel Files

Nov 5, 2007

Hi,
Trying to dynamically set the connectionstring property of the excel source.
This is what I enter instead of the hardcoded excel file paths:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::FileName] + ";Extended Properties=Excel 8.0;HDR=YES"


I get this error, every time I set the delay validation property of the dataflow tab to true.
Cannot detach from one or more processes.
The object invoked has disconnected from its clients
Do you want to terminate them instead?

Thanks

View 3 Replies View Related

Data Files Path Not Location

Jan 28, 2008



Hi All,

Can plz any one help me, acutally as i know sys.files table gives you the acutally physical location of the database fiels with name as well like this

C:sqldatax.mdf

but what i m looking is, is there any qury or script that will give me only the path of the data,log, index files like this

C:sqldata

Thanks and looking forward.

-MALIK

View 5 Replies View Related

Urgent DataBase Restore Logfile Path Error Message

May 8, 2007

I am having difficulty restoring a database (DB_1) with 2 datafiles and one log file, DB Structure is as following:

Filegroup PRIMARY with file name 'fnm_data' with physical file name and location D:dbfile_1.mdf,
Filegroup 'FG1' with file name 'fgnm1_data1' with physical file name and location F:dbfile_FG1.mdf,
One log file with file name 'fnm_log' with physical file name and location (E:loglog_db.ldf)

{Note} Logfile resides on E drive whereas Datafiles reside on several other drives.

I need to restore the DB on another machine. And I need to move the log file to a drive other than E.In this case it is K drive. Hence I have used the following code,

restore log DB_1 from disk='M:kupccciclog.txt'

WITH RESTRICTED_USER , MOVE 'fnm_log'

TO 'K:DBlog_db.ldf', recovery, replace,RESTART

go



When I try to restore from backup files, I keep error message saying "Physical file name E:loglog_db.ldf may be incorrect." 'fnm_log' cannot be restored. Use Move command to identify a valid location for the file.

Even though I am using Move command to move the log file.



Then I found that if I create a drive with E: and a folder named 'log' then restore program runs alright. That is, when E:log exists then code does run smoothly. All the restore code is looking for the presence of path of the log file from where it is been backed up. In this case it is E:log folder. Once the database is restored I could kill that directory and nothing happens. Also log file has been restored on K:DB only.

Why the restore code is looking for the initial drive letter and path even though I have used Move command? Is there an issue in my code?

Any help will be highly appreciated.

View 3 Replies View Related

Using Fn_trace_gettable On Trace Files Where The Path Contains Aspace.

Mar 19, 2008

Hi,Is there a way to read a trace file with fn_trace_gettable ifthat trace file resides in a path that contains a space? For example,test.trc is accessible with fn_trace_gettable if it resides in c: races, but throws an error if the trace file is in c:my traces.Thanks.-Nada

View 1 Replies View Related

Transact SQL :: Verify Inserted Values From One Table (in CSV File) With Another Table (in Database)

Aug 4, 2015

I am looking for a Sql query to verify the inserted values from one table(in CSV file) with another table(in sql database)

For example: I have below Values column that is present in once CSV file, after my data migration the values get stored in Results table under Message column.

I need to very whether values(1X,1Y) are inserted in Message record "successfully inserted value 1X"

Values (CSV)
1X
1Y

Results Table(SQL)
CreatedDate                   Message
2015-08-04 08:45:29.203  successfully inserted value 1X
2015-08-04 08:44:29.103  TEst pass
2015-08-04 08:43:29.103  successfully inserted value 1X
2015-08-04 08:42:29.203  test point
2015-08-04 08:35:29.203  successfully inserted value 1Y
2015-08-04 08:30:29.203  Test Pass
2015-08-04 08:28:29.203  successfully inserted value 1Y

If all values are inserted:

Output:
All values from values table are inserted successfully
Total count of values inserted: 2
If only few values are inserted, example only 1X from Values table is inserted in Message

Example:
Results Table CreatedDate     Message
2015-08-04 08:45:29.203  successfully inserted value 1X
2015-08-04 08:44:29.103  TEst pass
2015-08-04 08:43:29.103  successfully inserted value 1X
2015-08-04 08:42:29.203  test point

Output:
All values from values are not inserted successfully in result table.
Total count of values inserted: 1
Missing Values not inserted in results table are: 1Y

View 3 Replies View Related

SQL Server 2008 :: Check For Missing Rows In A Table

Oct 20, 2015

I have a table of languages, identified by a lang_id column as follows:

LANG_IDLANG_NAME
deDeutsche
enEnglish
plPolski
trTurkish
czCzech

I also have a RESOURCES table of phrases (for translation purposes) similar to this:

res_id res_lang res_phrase
AccessDenied en Access Denied

For some rows in the resources table I do not have all language codes present so am missing some translations for a given res_id.My question is what query can I use to determine the RESOURCE.RES_IDs for which I do not have a translation for.

For example I might have a de, en, cz translation for a phrase but not a pl phrase and I need to identofy those rows in order that I can obtain translations for the missing RESOURCE rows.

View 6 Replies View Related

Transact SQL :: Concatenate Display Name Using XML PATH

Oct 29, 2015

I need to concatenate the DisplayName column with distinct UserName and SysName using XML path

 SELECT [sysName], [User_Name],[DisplayName] FROM
 (SELECT v_Add_Remove_Programs.DisplayName0 AS [DisplayName], v_Add_Remove_Programs.Publisher0 AS [Publisher]
, v_R_System_Valid.Netbios_Name0 AS[sysName],v_R_System_Valid.User_Name0 AS [User_Name],v_Add_Remove_Programs.Version0 as [Version]
FROM [Offline].[dbo].v_Add_Remove_Programs
JOIN  [Offline].[dbo].v_R_System_Valid ON [Offline].[dbo].v_Add_Remove_Programs.ResourceID = [Offline].[dbo].v_R_System_Valid.ResourceID)

[code]....

View 3 Replies View Related

Transact SQL :: Combine Two Rows To One Without XML Path

Aug 13, 2015

I have one table list this

declare @test table(Id int, Description varchar(500))
insert into @test
values (1, '<b>Name :</b> XUZ <br/><br/>'),
       (1, '<b>Type : </b> QWE <br /><br/>'),
  (2, '<b>Name : </b> ABC <br /><br/>'),
  (2, '<b>Type : </b> FGH <br /><br/>')

My expected result is 

1, '<b>Name :</b> XUZ <br/><br/> <b>Type : </b> QWE <br /><br/>'
2, '<b>Name : </b> ABC <br /><br/> <b>Type : </b> FGH <br /><br/>'

As you can see its combine two rows of data group by id. Issue is If I use for xml path('') then its replace my html tags <b> to like <b> so after that then I again i need to replace all these symbols. Is it possible to get expected result without using xml path or if we use xml path then still my html tag leave as it is.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved