Storing Result Set From RESTORE HEADERONLY
Could anyone please tell me whether and how I can store the result set from the RESTORE HEADERONLY ?
Thanks
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Restore HeaderOnly Problem
Hi everybody Our server has crashed and only we can rescue some SqlServer 2000 Backup file with recovery softwares . Now we want to restore them , but we get this error message : " Restore Header Is Terminating Abnormally , its not a valid backup" whereas we sure they are correct backup before crashing . How can we Solve this problem or Fix this Files for restoring ? it would be convenient if you could help us .
View Replies !
View Related
Capture Output Of Restore Headeronly Cmd
I want to capture the output of the RESTORE HEADERONLY command into a table but so far I've not been smart enough to do it. I know that I could run it manually then save the output to a file but that's not going to work for me in this case. I tried using the command along with Insert (just they way I would a select stmt) but SQL didn't appreciate it. Has anyone done this before? Got any ideas? Sidney Ives Database Administrator Sentara Healthcare
View Replies !
View Related
Storing Result Of EXEC Into A Variable
Thanks for everyone's help. I used sp_executesql and that worked atreat.I used the following code inside a cursor to go round all the usertables and to store the counts in a separate table.SET @tmp_select = N'SELECT @mycount = count(*) from [' + @tbl_owner+ '].[' + @tbl_name + ']'EXEC sp_executesql @tmp_select, N'@mycount int OUTPUT', @mycountOUTPUTupdate user_tables set numrows=@mycount where [name]=@tbl_name andowner=@tbl_ownerfetch next from tbl_cursor into @tbl_name, @tbl_owner
View Replies !
View Related
Storing Values Into Variable From A Distributed Query Result
Hi. I am trying to store the column value to a variable from a distributed query. The query is formed on the fly. i need to accomplish something like this declare @id int declare @columnval varchar(50) declare @query varchar(1024) @Query = "select @columnval = Name from server.database.dbo.table where id ="+convert(varchar,@ID) exec (@query) print @Columnname -MAK
View Replies !
View Related
Storing The Result In A Variable Resulting From A Dynamic TSQL Query
Hello all: Here is a sample query: DECLARE @KEYID NVARCHAR (50) ; SET @KEYID = '1074958' DECLARE @ENTITY NVARCHAR (100); SET @ENTITY = 'HouseDimension' DECLARE @KeyCol NVARCHAR(50); SET @KeyCol = (SELECT LEFT(@ENTITY, (SELECT CHARINDEX( 'DIM', @ENTITY) -1)) )+ 'Key' DECLARE @KeyValue NVARCHAR (1000) SET @KeyValue = 'SELECT '+ @KeyCol + ' FROM HouseManagementFact WHERE HouseKey = ' + @KEYID + ' GROUP BY ' + @KeyCol + ' HAVING SUM(TotalClaimCount) > 0 OR SUM(HouseCount) > 0 ' The value resulting from Executing @KeyValue is an integer. I want to store this value in a new variable say @VAR2 When I do this DECLARE @VAR2 INT SET @VAR2 = execute sp_executesql @KeyValue its giving me an error. can somebody let me know the correct form of storing the value resulting from @KeyValue in some variable ?
View Replies !
View Related
Load Headeronly From Logbackup Dump Device
I'm trying to capture the info that gets passed back from the 'load headeronly from logbackup' command in a script that I'm writing. The MS Transact-SQL reference specifies that this info is passed back in a table, a row for each dump on the given dump device. I'm looking for the SQL construct that will allow me to capture this info as variables in my script for processing. I've tried to create a temp table that mirrors the info returned and insert into this table by executing the load command but syntactically it is not correct(with that syntax the compiler assumes that the load command is a stored procedure and can't locate it) Specifically, I'm trying to capture info from the dump transaction with no_truncate command. It appears the dump info does not go the the msdb..sysbackuphistory table when the no_truncate option is used. This dump info can only be obtained thru the load headeronly command. Any thoughts on how to code the sql to capture this info?
View Replies !
View Related
Result Set Of ‘RESTORE HEADERONLY’
Could you tell me how to put result set of ‘RESTORE HEADERONLY’ into a temporary table? I received an Error, when I execute the line below. INSET INTO #temp EXEC RESTORE HEADERONRY FROM dvcBACKUP1 The #temp is a temporary table that has same structure as the result set of ‘RESTORE HEADERONLY.’ The dvcBACKUP1 is a backup device, and ‘RESTORE HEADERONLY FROM dvcBACKUP1’ gives back its result set well. Thanks to advance.
View Replies !
View Related
Storing The Result Of A &&"Select TOP 1&&" Into A Variable
hello Does anybody know how to store the result of a select top 1 into a variable?? I have this code: Select @status = Select top 1 status from venta where Origin ='Pedido Autos nuevos' order by fdate desc And also this: Select @status = top 1 status from venta where Origin ='Pedido Autos nuevos' order by fdate desc But none of them work Any ideas?? Thanks
View Replies !
View Related
Backup And Restore Using Tape - Strange Result
Hi I have two database called test1 and test2 both are of same size(both device and log). I run the following statements to take the backup of both the databases using the tape device 'tapedevice1'. dump database test1 to 'tapedevice1' dump database test2 to 'tapedevice1' After this I run the load statement load database test2 from 'tapedevice1'. It just restore the database test2 with test1 data which is added first to the tape with a warning. Is there any restriction that in a single tape backup of more than one database is not possible. Your valuable suggestion appreciated Jiji
View Replies !
View Related
Which Is Better? Storing Data In The Database OR Storing It In The File System
Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?
View Replies !
View Related
Set Variable Based On Result Of Procedure OR Update Columns Fromsproc Result
I need to send the result of a procedure to an update statement.Basically updating the column of one table with the result of aquery in a stored procedure. It only returns one value, if it didnt Icould see why it would not work, but it only returns a count.Lets say I have a sproc like so:create proc sp_countclients@datecreated datetimeasset nocount onselect count(clientid) as countfrom clientstablewhere datecreated > @datecreatedThen, I want to update another table with that value:Declare @dc datetimeset @dc = '2003-09-30'update anothertableset ClientCount = (exec sp_countclients @dc) -- this line errorswhere id_ = @@identityOR, I could try this, but still gives me error:declare @c intset @c = exec sp_countclients @dcWhat should I do?Thanks in advance!Greg
View Replies !
View Related
Table-valued User-defined Function: Commands Completed Successfully, Where Is The Result? How Can I See Output Of The Result?
Hi all, I copied the following code from Microsoft SQL Server 2005 Online (September 2007): UDF_table.sql: USE AdventureWorks; GO IF OBJECT_ID(N'dbo.ufnGetContactInformation', N'TF') IS NOT NULL DROP FUNCTION dbo.ufnGetContactInformation; GO CREATE FUNCTION dbo.ufnGetContactInformation(@ContactID int) RETURNS @retContactInformation TABLE ( -- Columns returned by the function ContactID int PRIMARY KEY NOT NULL, FirstName nvarchar(50) NULL, LastName nvarchar(50) NULL, JobTitle nvarchar(50) NULL, ContactType nvarchar(50) NULL ) AS -- Returns the first name, last name, job title, and contact type for the specified contact. BEGIN DECLARE @FirstName nvarchar(50), @LastName nvarchar(50), @JobTitle nvarchar(50), @ContactType nvarchar(50); -- Get common contact information SELECT @ContactID = ContactID, @FirstName = FirstName, @LastName = LastName FROM Person.Contact WHERE ContactID = @ContactID; SELECT @JobTitle = CASE -- Check for employee WHEN EXISTS(SELECT * FROM HumanResources.Employee e WHERE e.ContactID = @ContactID) THEN (SELECT Title FROM HumanResources.Employee WHERE ContactID = @ContactID) -- Check for vendor WHEN EXISTS(SELECT * FROM Purchasing.VendorContact vc INNER JOIN Person.ContactType ct ON vc.ContactTypeID = ct.ContactTypeID WHERE vc.ContactID = @ContactID) THEN (SELECT ct.Name FROM Purchasing.VendorContact vc INNER JOIN Person.ContactType ct ON vc.ContactTypeID = ct.ContactTypeID WHERE vc.ContactID = @ContactID) -- Check for store WHEN EXISTS(SELECT * FROM Sales.StoreContact sc INNER JOIN Person.ContactType ct ON sc.ContactTypeID = ct.ContactTypeID WHERE sc.ContactID = @ContactID) THEN (SELECT ct.Name FROM Sales.StoreContact sc INNER JOIN Person.ContactType ct ON sc.ContactTypeID = ct.ContactTypeID WHERE ContactID = @ContactID) ELSE NULL END; SET @ContactType = CASE -- Check for employee WHEN EXISTS(SELECT * FROM HumanResources.Employee e WHERE e.ContactID = @ContactID) THEN 'Employee' -- Check for vendor WHEN EXISTS(SELECT * FROM Purchasing.VendorContact vc INNER JOIN Person.ContactType ct ON vc.ContactTypeID = ct.ContactTypeID WHERE vc.ContactID = @ContactID) THEN 'Vendor Contact' -- Check for store WHEN EXISTS(SELECT * FROM Sales.StoreContact sc INNER JOIN Person.ContactType ct ON sc.ContactTypeID = ct.ContactTypeID WHERE sc.ContactID = @ContactID) THEN 'Store Contact' -- Check for individual consumer WHEN EXISTS(SELECT * FROM Sales.Individual i WHERE i.ContactID = @ContactID) THEN 'Consumer' END; -- Return the information to the caller IF @ContactID IS NOT NULL BEGIN INSERT @retContactInformation SELECT @ContactID, @FirstName, @LastName, @JobTitle, @ContactType; END; RETURN; END; GO ---------------------------------------------------------------------- I executed it in my SQL Server Management Studio Express and I got: Commands completed successfully. I do not know where the result is and how to get the result viewed. Please help and advise. Thanks in advance, Scott Chang
View Replies !
View Related
Saving Query Result To A File , When View Result Got TLV Error
HI, I ran a select * from customers where state ='va', this is the result... (29 row(s) affected) The following file has been saved successfully: C:outputcustomers.rpt 10826 bytes I choose Query select to a file then when I tried to open the customer.rpt from the c drive I got this error message. I am not sure why this happend invalid TLV record Thanks for your help Ali
View Replies !
View Related
End Result Is Main Query Results Ordered By Nested Result
As the topic suggests I need the end results to show a list of shows and their dates ordered by date DESC. Tables I have are structured as follows: SHOWS showID showTitle SHOWACCESS showID remoteID VIDEOS videoDate showID SQL is as follows: SELECT shows.showID AS showID, shows.showTitle AS showTitle, (SELECT MAX(videos.videoFilmDate) AS vidDate FROM videos WHERE videos.showID = shows.showID) FROM shows, showAccess WHERE shows.showID = showAccess.showID AND showAccess.remoteID=21 ORDER BY vidDate DESC; I had it ordering by showTitle and it worked fine, but I need it to order by vidDate. Can anyone shed some light on where I am going wrong? thanks
View Replies !
View Related
CASE Function Result With Result Expression Values (for IN Keyword)
I am trying to code a WHERE xxxx IN ('aaa','bbb','ccc') requirement but it the return values for the IN keyword changes according to another column, thus the need for a CASE function. WHERE GROUP.GROUP_ID = 2 AND DEPT.DEPT_ID = 'D' AND WORK_TYPE_ID IN ( CASE DEPT_ID WHEN 'D' THEN 'A','B','C' <---- ERROR WHEN 'F' THEN 'C','D ELSE 'A','B','C','D' END ) I kept on getting errors, like Msg 156, Level 15, State 1, Line 44Incorrect syntax near the keyword 'WHERE'. which leads me to assume that the CASE ... WHEN ... THEN statement does not allow mutiple values for result expression. Is there a way to get the SQL above to work or code the same logic in a different manner in just one simple SQL, and not a procedure or T-SQL script.
View Replies !
View Related
Strange Result - Minus Result -1
help strange result whan i do this Code Snippet SELECT unit_date, unit, ISNULL(NULLIF ((unit + DATEDIFF(mm, GETDATE(), unit_date)) % 4, 0), 4) AS new_unit FROM dbo.empList i try to get next unit value to next month why i get this -1 on date 01/01/2008 1 -1 unit_date unit new_unit 01/02/2008 2 1 01/02/2008 1 4 01/01/2008 1 -1 01/02/2008 1 4 21/01/2008 1 -1 21/01/2008 1 -1 01/02/2008 1 4 TNX
View Replies !
View Related
Syntex For Restore Filelistonly && Restore Verifyonly
Hello, Would some one please help me with the syntex on how to run "restore filelistonly" or restore verifyonly" on a SQL backup which has multiple filesets?? My backups locations are as follow: RESTORE VERIFYONLY From disk = 'E:syndicated_databank__bkup_01.bak', 'E:syndicated_databank__bkup_02.bak', €˜E:syndicated_databank__bkup_03.bak€™, €˜E:syndicated_databank__bkup_04.bak€™, €˜E:syndicated_databank__bkup_05.bak€™ I tried to do a restore with the above, I got error The label 'E' has already been declared. Label names must be unique within a query batch or stored procedure. Please advise!!
View Replies !
View Related
Storing SID's In SQL 7.0
I need to store a user ID of whoever made the last change to a record in a table. I have added a field with a default set to 'suser_sid()'. Is it wise to store SID's in a database table if you are using NT authentication? My concerns are that if the user is deleted by the NT system administrator then I lose data integrety also if the database is backed up and restored onto a different machine with different users it won't work at all. I'd be grateful for any help with this. Rich
View Replies !
View Related
Storing Date ONLY
Hi all! I am back with a new problem. I am designing a database in which the booking is on an hourly basis instead of daily basis. So I want my colums in a table to be like this: ================================ID(PK)Date(In this table I want date only)TimeSlot(in this table I want time only)CourtNo(facility which is to be booked)Booking ID(FK to booking table)================================ The thing is that SQL server donot have a date only format. I am totally stuck on this one, please help! The database which I created will be ideal if I can just store the date! Regards, Taimoor
View Replies !
View Related
Storing Paragraph
Hi All,Does anybody know how i can store a paragraph with spaces, newline, empty lines in a sql server 2005 database table? What data type should i declare the table entry to take? I will also like to retrieve the data with what ever i would have stored it with.
View Replies !
View Related
Storing Images
Hi, can someone help me with this problem. I have recently downloaded VWD and have been playing around with it a bit. I was windering how do I add an image file to a SQL database. I have used SQL in the past but I have never store an image in it. I can add text data and so forth, but I need some pointers into adding images to the sql database. I want to be able to store the images and then retrieve them to a GridView. I have the images in an image folder within the website, but I do not know how to input the reference or link to the images in an sql table. A quick example, say I have a table called Images, with the following info:imgID (int)imgDesc (varchar(max)imgFile (img)imgTitle (varchar(20)) To input this in sql I would write Insert Into Images (imgDesc,imgFile,imgTitle) Values ("Large fishy", "", "The Big Fish") what would I need to put for imgFile? I would really appreciate if someone can point me in the right direction.
View Replies !
View Related
Storing A Month
Hello all,I have been working with several databases here that are basically datamarts. A lot of the entities have an attribute that is a particularyear and month. For example, a financial transaction may be posted fora particular month, regardless of the actual date on which it occurred.In this system, these year/month combinations have typically beenstored as integers of the form YYYYMM. My question is, how have othersstored this type of information and what advantages/disadvantages haveyou found to your method?The problem that I have found with the current method is that youcannot easily find the difference between two of these dates. Forexample, 200401 - 200312 = 89 (not 1). Storing the values as datetimes(using the first of the month) allows for DATEDIFF(mm, '2003-12-01','2004-01-01') = 1. Of course, a little extra (and meaningless) data isbeing stored. In case the table sizes makes a difference here due tothe extra data being stored, we are usually talking about over 100Mrows.I don't like the idea of storing the values in two columns (year andmonth) because that does nothing to improve on the ability to performuseful functions on the values and very importantly, the month reallyhas no meaning without the year, so I don't think that it should bestored by itself.Thanks for any advice/insight.-Tom.
View Replies !
View Related
Help Me Out For Storing More Data
CREATE TABLE [dbo].[blogs] ( [blog_title] [nvarchar] (500) , [blog_desc_full] [varchar] (8000) , [blogger_name] [nvarchar] (100) , [mailid] [nvarchar] (100) , [blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL , [blog_desc] [nvarchar] (125) , [cat_name] [varchar] (100) , [b_url] [varchar] (250) , [b_date] [datetime] NULL , [author] [nvarchar] (250) , [approval] [char] (1) ) ON [PRIMARY] GO using this script i have created my blog table. and a procedure given below. i am using to insert data in it. CREATE PROCEDURE SP_BlogAdd @blog_title nvarchar(500), @blog_desc_full varchar(8000), @blogger_name nvarchar(100), @mailid nvarchar(100), @blog_desc nvarchar(125), @cat_name varchar(100), @b_url varchar(250), @author nvarchar(250) AS INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author) VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author) GO now, the problem i m facing is. i am using varchar datatype for [blog_desc_full] [varchar] (8000). i want more than this size to store data in it. please give me some detailed code. i tried text datatype but i didnt succeed. how to use text datatype. i replaced with text datatype.but in length i couldnt type. it shows only 16. Please help me out. regards, ASIF
View Replies !
View Related
Storing Hours
I use SQL 2K with an Access 2000 project as front end. I have four date fields in a table. The first one should contain a date (eg 20th of February), the second one a starting hour (eg 8:00h), the third one the finishing hour (eg 10:00h) and the fourth should calculate the difference between the second and third column. So I created four datetime fields. Storing a date in the first column is no problem, but storing only hours doesn't seem to do what I want. When I enter 8:00 from within the Access, it is stored 1/1/1900 8:00 in SQL Server. How can I make sure that the hours are saved with the date of the second column, so either as 8:00 without further information or as eg 20-2-2004 8:00?
View Replies !
View Related
Storing Blob In Sql
Hi I want to store the image into the sql database through VC++ as front end. Here i am trying to insert the ole object into database. But iam unable to insert it because i don't the exact query to insert the image into database and also i want to retrive back in the same manner. Pl try to get the solution Tanks And regards Srinath
View Replies !
View Related
Storing Tasks
Hi, I am wondering if anyone knows how to create task create scripts from existing tasks. I don't have enough info on how tasks are stored and their linkages in the msdb database
View Replies !
View Related
Storing XML Document
Hi, I would like to know what are the possible ways of storing XML document in a SQL Server 2000 database. I want to store XML document in the database and then perform Full-Text Indexing on it so that i am able to search the XML document for words and phrases. I think the possible scenerios could be :- 1) Store the whole XML document as is in a Text field using DTS. 2) Store each element node of the XML document as a field in a table using OPENXML. Is there any other way also in which an XML document could be stored in a DB ? Off the 2 scenerios given above, which one is better ? Thanks Sumit.
View Replies !
View Related
Storing Images
Hello All! Can some one give SQL Statement on storing images from disk to the database columns. Once I store the image how do I test it out that the image is stored correctly? For example this is what I did I have a table called table1., field called name insert into table1(name) values(C:123.bmp) Is the above statement correct? will it store the file or not? if it does store them then how do I view them? Can some one please help me... Thanks in advance for your help Venkat
View Replies !
View Related
Storing Images In DB
Does anyone have thoughts or know of resources that explain the pro's and con's of storing images in a database versus keeping the image in the file system and just storing the path to the image in the database?
View Replies !
View Related
Storing Data
Hi again. How do I store in SQL SERVER with 2 decimal places? I set Data Type to Decimal with Scale set to 4 and Precision 19. But this doesn't work. Any ideas? Thanks.
View Replies !
View Related
Help Me Out For Storing More Data
CREATE TABLE [dbo].[blogs] ( [blog_title] [nvarchar] (500) , [blog_desc_full] [varchar] (8000) , [blogger_name] [nvarchar] (100) , [mailid] [nvarchar] (100) , [blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL , [blog_desc] [nvarchar] (125) , [cat_name] [varchar] (100) , [b_url] [varchar] (250) , [b_date] [datetime] NULL , [author] [nvarchar] (250) , [approval] [char] (1) ) ON [PRIMARY] GO using this script i have created my blog table. and a procedure given below. i am using to insert data in it. CREATE PROCEDURE SP_BlogAdd @blog_title nvarchar(500), @blog_desc_full varchar(8000), @blogger_name nvarchar(100), @mailid nvarchar(100), @blog_desc nvarchar(125), @cat_name varchar(100), @b_url varchar(250), @author nvarchar(250) AS INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author) VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author) GO now, the problem i m facing is. i am using varchar datatype for [blog_desc_full] [varchar] (8000). i want more than this size to store data in it. please give me some detailed code. i tried text datatype but i didnt succeed. how to use text datatype. i replaced with text datatype.but in length i couldnt type. it shows only 16. Please help me out. regards, ASIF
View Replies !
View Related
Storing A String As An Int
I am writing an app in c#. I will be using the following code to get a number from the user. I had to make the variable a string to prevent any kind of conversion to be required. string newID; Console.WriteLine("Enter a new ID"); newID = Console.ReadLine(); Console.WriteLine("The new ID is {0}", newID); Console.ReadLine(); The ID that this will be collecting will be stored in a SQL Server 2005 Express database. The field in the database is of the type int. Will there be a problem saving this number from the code above into the database? Will there be a problem b/c the datatypes don't match? ..........................................thanks to any willing to help
View Replies !
View Related
Storing Date
i need to store date alone in a new field from the existing field which is stored date along with time. Eg: old field: emplogintime (date and time) new field: emploginday (date)
View Replies !
View Related
Storing Records
I have a table name "ABCD" When I run a Select statement on this table, it returns 100 rows. I would like to store this 100 records for future. In future I will have the same table with same sturcture. I want to insert this 100 rows into this table. Any suggestions. Thanks in Advance
View Replies !
View Related
Storing A Value, Vs Computing A Value
Hi, I'm having a DB designed for me, and I'm inspecting it and wondering what in general is the better way to do this. We have a product, which we are counting "product views". The DB designer has created columns called "view_today" and "views_alltime". I specified I wanted a normalized database, I'm thinking this is technically not normalized ? Am I correct ? Wouldn't it be better to have a query that counted the views off the logging table ? I can't see any advantage to doing it the way its been designed except to save time. Thanks for any input ! Mike123
View Replies !
View Related
|