Sunday, March 25, 2012
attach Help
but i always receive an error message "database is write protect ......"
What I do wrong ?
byeFirst of all, what did you do?|||Are the three files read-only at the O/S level? This can happen if the three files were sent as attachments in e-mail.|||could it be that the database already exists and in read-only mode?|||Are we even talking about SQL Server?
And when does the damn weekend start already.....
DECLARE @.Weekend datetime
SELECT @.Weekend = 'Jan 16 2004 17:00:00'
SELECT DATEDIFF(mi, GetDate(), @.Weekend)/60.00 As Hours_till_Margaritaville|||Sorry for mistakes
I'll start again
i have 3 Files xxx.mdf,xxx.ndf,xxx.ldf from originally sql7 ,from network and I'd like to atach to Sqlserver 2000; on sql server 2000 is the database not present
With Query Analyzer I tested i did:
Exec sp_attach_db
@.dbname="xxx",
@.filename1= "xxx.mdf",
@.filename2= "xxx.ndf",
@.filename3= "xxx.ldf"
With Sql 2000 Manager I use The menu attach
In both case i received this message "The Database is write Protect you
have to unptrotect.......
bye|||Right click on each file in succession, go to properties, and see if any of them have the read-only checkbox marked. If so, uncheck that box.|||I checked the free file , they all are not write protect|||As a test, see if you can rename one of the files. Maybe backup software, or virus scan has it open?
I just tried a test of re-attaching a readonly filegroup, and it worked. Although, I do not have access to a 7.0 machine, anymore to try out a readonly filegroup with an upgrade.
That sparks a thought. Do you have access to the database in it's original state? That is, can you see if the original database (on SQL 7.0) is read only or had read only filegroups?|||I can rename the files, and I open the file .ndf with an Hex editor
there are more line with read only inside the file
bye
Sunday, March 11, 2012
Assigning the for xml query output to a variable
I would like to generate an XML query using the 'for xml' clause and assign
that to a text variable for further manipulation.
for e.g., I would like to do some thing like this.
declare @.test text
Set @.test = Select * from test_table for xml auto
But this gives my the syntax error. Can anyone help capturing the xml output
of a query into a variable?
Regards,
ArunHi
Have you looked at the text datatype limitations. You can not use a lot of
the T-SQL string manipulation functions against it, so you can't really do
much with it once you have it.
You can do a SELECT ... INTO ... to write it to a temporary table, then
select it into your @.test variable. I have not tried it, but is a
suggestion.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Arun" <kathir_arun@.hotmail.com> wrote in message
news:ePOh0u8QFHA.576@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I would like to generate an XML query using the 'for xml' clause and
> assign
> that to a text variable for further manipulation.
> for e.g., I would like to do some thing like this.
> declare @.test text
> Set @.test = Select * from test_table for xml auto
> But this gives my the syntax error. Can anyone help capturing the xml
> output
> of a query into a variable?
> Regards,
> Arun
>
Assigning one text box value to the other text box in the sql reporting services Form
Hi,
Can some one help me in this case,
I am manipulating a value for onetext.value , And I want to assign like this
seconetext.value = onetext.value in the SQl reporting services form,
Is it possible? if so can any one help me with the syntax?
-Thanks
Yes, this is possible.
In "seconetext", use this expression:
=ReportItems!onetext.Value
-Chris
Thursday, March 8, 2012
Assigning a Text Variable
select sum(item_price) as item_price, sum(item_qty) as item_qty, avg (item_price) / avg(item_qty) as average_price from x_invoic
where item_code = (item from a different table)
and status = 9
The "item from a different table" are items that I'm interesting in compiling this data for. I'm not sure what the best way to "cycle" through these items is but I would like to get data on each one of them. I was thinking of using a variable, if possible, but I'll do whatever works.
Any input is appreciated.
Regards,
TechRickUse IN and GROUP BY|||Originally posted by jzhu
Use IN and GROUP BY
Thanks!
Saturday, February 25, 2012
Assembly: returning "Globals!ReportName" but letting RS see it as code, not text?
I'm trying to make a reusable header function. In it, there is the report name and a couple other bits of info. The problem is making RS use the real report name
If I return "Globals!ReportName" in an assembly function, then call that function, I get that exact text - but what I really want is the report name. I understand what it's doing, but how to I trick it:
Is there some way to make RS aware of the fact that this is meant to be seen as something it needs to evaluate rather than just displaying the actual text?
How about passing the report name to your function as a parameter and then return the name in the return value?|||that might be an option.
It's very similar to what i have in place - just appending the report name to the return value.
|||You probably tried this, but would it work to set a variable = Globals!ReportName.Value and then concatenate the variable with your other strings?|||If you mean in the .net assembly, I just tried it and no luck, but thanks. It seems any text returned is taken to be literal, not code. I even tried something like {Globals!ReportName} - hoping to get lucky, but didn't.
Sunday, February 12, 2012
ASP.NET and SQL Server DTS
I want to refill a sql server table through a flat text file(CSV) in ASP.NET just giving the file name. Can somebody help me in this regard that i can do this.
Thanks & Best Regards
Hi saeednawaz,Check here for solution
http://bhatiaworld.blogspot.com/2005/06/transfering-data-from-text-filesource.html
But this solution is not taking ASP.net into consideration, but it will surely help u.|||
Hello,
Here is an example
' This example assumes the existence of a text file named myFile.txt ' that contains an undetermined number of rows with seven entries ' in each row. Creates a new DataSetDim myDataSet As New DataSet()' Creates a new DataTable and adds it to the Tables collectionDim aTable As New DataTable("Table 1")myDataSet.Tables.Add("Table 1")' Creates and names seven columns and adds them to Table 1Dim Counter As IntegerDim aColumn As DataColumnFor Counter = 0 to 6 aColumn = New DataColumn("Column " & Counter.ToString()) myDataSet.Tables("Table 1").Columns.Add(aColumn)Next' Creates the StreamReader to read the file and a string variable to' hold the output of the StreamReaderDim myReader As New System.IO.StreamReader("C:\myFile.txt")Dim mystring As String' Checks to see if the Reader has reached the end of the streamWhile myReader.Peek <> –1 ' Reads a line of data from the text file mystring = myReader.ReadLine ' Uses the String.Split method to create an array of strings that ' represents each entry in the line. That array is then added as a ' new DataRow to Table 1 myDataSet.Tables("Table 1").Rows.Add(mystring.Split(","c))End WhileIn the above example, new dataset will be created with one table that contains the
data of the myfile.txt
If you want to just fill a table then iterate throught myfile.txt, split values
and fill rows.
HTH
regards