|
Where from can I get my data faster for viewing it throw Report in SSRS: from xml or from Excel-file?
Anyone!!!!!!!!!!!!
|
|
|
|
|
I trying to make my demo for
"Take Data Offline Using Microsoft Synchronization Services for ADO.NET"
I am using SQL Server 2005 on a server side and SQl Express on Client side, I have created my "Orcast" Database on both side ( Server as well as Client). but when I click on "Synchronize" but it will not work. In Demo they are used one "pub.sdf" file on client side , & I have created Database on client side ,they have given Path of that file , I have to give database connection string Like (its for client)
"Data Source=USIL-1;Initial Catalog=Orcast;Integrated Security=True";
it's urgent
Regards
Vikas Shirsath
|
|
|
|
|
i have some errors while implementing stored procedure for sql server 2005 in my web form which i have design using vb dot net 2005. my code is like this:
i have made stored procedure like this:
ALTER PROCEDURE UpdateMemberInfo
@FName varchar(50),
@LName varchar(50),
@Password varchar(50),
@MemberName varchar(50)
AS
update T_Members set FirstName = @FName,LastName = @LName ,Password = @Password where MemberName = @MemberName
RETURN
Now i have to call this stored procedure in the click event of the button. So, i put the code like this in the button:
co.startconn()
cmd = New SqlCommand("UpdateMemberInfo", co.oConn)
cmd.CommandType = Data.CommandType.StoredProcedure
Try
para = New SqlParameter("@FName", fname)
cmd.Parameters.Add(para)
para = New SqlParameter("@LName", lname)
cmd.Parameters.Add(para)
para = New SqlParameter("@Password", pass)
cmd.Parameters.Add(para)
Catch
Response.Write(Err.Description)
End Try
Try
cmd.ExecuteNonQuery()
Catch
Response.Write(Err.Description)
End Try
But still there is error like this:
Procedure or function 'UpdateMemberInfo' expects parameter '@FName', which was not supplied.
suchitamanandhar@hotmail.com
|
|
|
|
|
You haven't set the SqlDbType or the size for any of your parameters. You must set them.
Plus, you haven't actually assigned any values to the parameters, and you haven't actually put any condition on your update statement so all rows will be affected.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
create command object cmd
Cmd.parameter.add("@FName",SqlDB.Nvarchar).value =fname(you value)
Cmd.parameter.add("@LName",SqlDB.Nvarchar).value =Lname(you value)
.
.
then execute you command
cmd.ExecuteNonQuery();
Regards
Vikas Shirsath
|
|
|
|
|
Can somebody help to correct my SQL statement below with the correct transaction syntax?
<br />
BEGIN TRANSACTION<br />
<br />
DECLARE @TMPKEY varchar(10) <br />
DECLARE @NEWKEY varchar(10)<br />
<br />
SET @TMPKEY = '0707436'<br />
SET @NEWKEY = '070700058'<br />
<br />
Insert Into nnccdtrequestDetail<br />
(Requestno,RequestItemNo,DetailStatus)<br />
select @NEWKEY,RequestItemNo,DetailStatus from nnccdtrequestdetail<br />
Where RequestNo = @TMPKEY<br />
<br />
IF @@TRANCOUNT = 1<br />
COMMIT TRANSACTION<br />
<br />
IF @@TRANCOUNT <> 1<br />
ROLLBACK TRANSACTION
Dabsukol
|
|
|
|
|
The second @@TRANCOUNT statement is a problem. Basically, the @@Trancount tells you the active number of connections that are present on the connection.
COMMIT TRANSACTION decrements the transaction count, so if you have 1 active transaction before the commit, you have 0 active transactions after. As you can see, this is where your problem occurs - you are testing @@TRANCOUNT <> 1 to call rollback transaction when it is now 0. In otherwords, the rollback will always be attempted.
I would be tempted to rewrite this section as:
Insert Into nnccdtrequestDetail
(Requestno,RequestItemNo,DetailStatus)
select @NEWKEY,RequestItemNo,DetailStatus from nnccdtrequestdetail
Where RequestNo = @TMPKEY
IF @@ERROR = 0
BEGIN
-- There is no error here.
IF @@TRANCOUNT = 1
BEGIN
COMMIT TRANSACTION
END
END
ELSE
BEGIN
-- If I reach this point, there has been an error.
IF @@TRANCOUNT = 1
BEGIN
ROLLBACK TRANSACTION
END
END Actually, I would normally not use the @@TRANCOUNT method because I match BEGIN TRANSACTION statements with the relevant closing transaction statements.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
@@TRANCOUNT is useful if you've got nested transactions, because ROLLBACK TRANSACTION does not roll back to the last BEGIN TRANSACTION but to the first BEGIN TRANSACTION. A nested COMMIT TRANSACTION only decrements @@TRANCOUNT, only when @@TRANCOUNT is reduced to zero by a COMMIT TRANSACTION does the overall transaction get committed.
This surprises a lot of people.
If you need to roll back in the middle of a nested procedure and an error has NOT occurred (presumably you've detected some other logical error, not a physical error raised by SQL Server) you should use RAISERROR to set @@ERROR to something. Maybe you test whether @@TRANCOUNT is greater than zero in an error handler, in case the nested procedure you called has already rolled back. IIRC, you get an error if you try to roll back when the nested transaction count is already zero.
|
|
|
|
|
You're right, and I know this, but there seems to be no indication in the OP of a nested transaction - hence my comments and the modified version of the code.
-- modified at 10:45 Wednesday 25th July, 2007
[Edit]Reading my original post I see that I did mention the transaction count of 1 before the commit transaction leading to a transaction count of 0 afterwards.[/Edit]
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
okkishore wrote: how we will recover from database was lost or scatch.
It was deleted? Corrupted? The hard drive was thrown into a vat of acid?
okkishore wrote: when there no is backrecovery
You mean you wern't keeping backups?
If you've completly lost the database and you have no backup then it's gone and your not getting it back. Maybe in future you'll do backups.
If it's not completly gone you might be able to use an undelete program or fix the corruption.
EDIT: I just checked your post below. Did you try and get rid of the duplicates without backing up and then delete the entire thing by accident?
|
|
|
|
|
Well the wording you've used is complete nonsense.
|
|
|
|
|
What is the OP asking? I understand that it was an interview question, but how was the database lost?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
okkishore wrote: how we will recover from database was lost or scatch
Huh? What kind of stupid interview question was that? Without backing up the database, losing it or having the disc being scratched is pretty much a nail in the coffin for the database, unless you have very pricey hardware to pull data bits off hard disk platters.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
how can we delete duplicate rows when we are not using constraints
usings query only
kishore kumar.B
|
|
|
|
|
Select all the field you are concerned about and do a group by with a having
Something like this:
Select col1, col2, col3, col4, col5 from yourTable
group by col1, col2, col3, col4, col5
having count(*) > 1
Hope that helps.
Ben
|
|
|
|
|
it can't deleting it only selecting.
for select we are also
select select DISTINCT * from tablename
i need for deleting not for selecting
kishore
|
|
|
|
|
The query I gave you is to identify the duplicates. Once you have the duplicates there are several things you can do to delete them. If you already know how to identify the duplicates then you should be able to delete them. You can not use a distinct since that removes the duplicates. Do you have any id column or key column to uniquely identify each column?
Ben
|
|
|
|
|
any one i what that means the table that can have duplicate rows or particular rows.i already mension i can't give any constraints .
|
|
|
|
|
Ok well, if you don't have any unique key you should create one. Add a new column that is an identity. Then if you really don't which record you keep you can do a delete statement like this:
delete from yourTable yt
join
(Select max(id),col1, col2, col3, col4, col5 from yourTable
group by col1, col2, col3, col4, col5
having count(*) > 1) temp on yt.id = temp.id
Ben
|
|
|
|
|
Hi all,
I am using SQLServer2000,
I am trying to insert large amount of data into column of a table but i found only part of the data getting inserted into the table.
Then i have tried the following option to set the column size
sp_tableoption 'testmail', 'text in row', '7000'
After the above line get executed its better but still i am lagging behind to store total text .please help me some one
Thanks in advance
Yuva
|
|
|
|
|
the most data you can store in a row is 8000 bytes (so thats 8000 ascii charecters or 4000 unicode). If you need to store more than that you need to chop up the text and store it in multiple rows.
|
|
|
|
|
hi originSH ,
Thanks for your reply but my requiremet is store all the date ito one column i cannot chop up teh thing because i am getting that text dynamically..The text in the form of html
Thanks in Advance
Chandra Gupta
|
|
|
|
|
Change the datatype to text (or ntext for Unicode). Text stores 2^31 characters, and NText stores 2^30 characters.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi Pete O'Hanlon,
I have used text data type only but it is not allowing me store whole text(Actually the text in the form of HTml) into my Database
|
|
|
|