|
when i want to Clear my record in SQL server 2005 i used this code:
USE [Test]
GO
DELETE FROM TblAuditTrial;
DELETE FROM TblAuditTrialGroup;
DELETE FROM TblGrossProfit
DELETE FROM TblMenu
DELETE FROM TblMenuCategory
DELETE FROM TblMenuSubCategory
DELETE FROM TblOrderDetail
DELETE FROM TblOrderStatus
DELETE FROM TblPayment
DELETE FROM TblPaymentDetail
DELETE FROM dbo.TblProject
DELETE FROM dbo.TblRefund
DELETE FROM dbo.TblReport
DELETE FROM dbo.TblReportGroup
DELETE FROM dbo.TblStockOutGross
DELETE FROM dbo.TblUnit
DELETE FROM dbo.TblUser
DELETE FROM dbo.TblUserGroup
DELETE FROM dbo.TblUserGroupPermission
DELETE FROM dbo.TblUtilities
DELETE FROM dbo.TblVoidOrder
DELETE FROM dbo.TblVoidStockIn
DELETE FROM dbo.TblVoidStockOut
DELETE FROM dbo.TlkpNext
DELETE FROM dbo.TlkpPermissionCategory
DELETE FROM dbo.TrelBranchUser
DELETE FROM dbo.TlkpPermission
Go
It's is not easy for me, cos i must drop down alot ..
Can any one give me some easy way? i'm a new Learner, thanks..
|
|
|
|
|
|
I'm very thank...but I don't know clearly...Can you give me some sample?
|
|
|
|
|
use this
select distinct 'delete from '+ Table_Name from information_Schema.columns
or
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'
|
|
|
|
|
Thank you so much ...Now I'm succeed in this code:
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'
Can you give me some more sample about the first code ? I'm still error with this:
select distinct 'delete from '+ Table_Name from information_Schema.columns
|
|
|
|
|
Good Morning Loeurt
Truncate is more Faster than Delete
truncate table dbo.TlkpPermission
Use Truncate not Delete
Hope it Helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Use Truncate over delete
Niladri Biswas
|
|
|
|
|
How can i protect my database in foxpro so that no one can alter my database.
Should it be password protected or read only mode.
plz help.
thanx in adv.
|
|
|
|
|
go for password protected option.
|
|
|
|
|
how can i do this.I don't know about it in foxpro....
I have searched on internet but find nothing..
|
|
|
|
|
Hi,
I was trying the extract the records from a table which is currently used by some other user for updation/insertion.
My question is , Is there any way to read the committed data for a row which is presently locked because updation on this row is going on and transaction is not completed.
Thanks
|
|
|
|
|
use NoLock for dirty reading
Select cloumnName from Table with NoLock
himanshu
|
|
|
|
|
Hi,
Suppose i update the row
Begin tran
Update table set column = 'some val' where id = 9
it's original value is val
now suppose transaction completes after some time, and mean while a user selects this table and the user should read
val
not some val
Any Idea?
I dn't want to ready dirty data and also don'y want the query to get blocked
|
|
|
|
|
I am getting this error
Msg 1084, Level 15, State 1, Procedure LOGIN_IP_RESTRICTION, Line 2
'LOGON' is an invalid event type.
while executing under code:-
CREATE TRIGGER [LOGIN_IP_RESTRICTION]
ON ALL SERVER FOR LOGON
AS
BEGIN
DECLARE @host NVARCHAR(255);
SET @host = EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]', 'nvarchar(max)');
IF(EXISTS(SELECT * FROM master.dbo.IP_RESTRICTION
WHERE UserName = SYSTEM_USER))
BEGIN
IF(NOT EXISTS(SELECT * FROM master.dbo.IP_RESTRICTION
WHERE UserName = SYSTEM_USER AND ValidIP = @host))
BEGIN
ROLLBACK;
END
END
END;
i am running it on mAster database and i am using SQL server 2005 standard edition.
thanks in advance
Aman
|
|
|
|
|
Did you install Service Pack 2?
I are troll
|
|
|
|
|
Eddy Vluggen wrote: Service Pack 2
Service Pack 3[^]
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
Hi i want to know how to Insert Data Into Database table from textbox on button click..?
Here's my codes..
<br />
<br />
namespace DataBindingListBox<br />
{<br />
public partial class Window1 : Window<br />
{<br />
public SqlConnection connection; <br />
public SqlCommand command; <br />
string sql = "Select Number From Tnumber";<br />
string connectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
<br />
public Window1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Window_Loaded(object sender, RoutedEventArgs e)<br />
{<br />
BindData();<br />
}<br />
<br />
private void BindData()<br />
{<br />
DataSet dtSet = new DataSet();<br />
using (connection = new SqlConnection(connectionString))<br />
{<br />
command = new SqlCommand(sql, connection); <br />
SqlDataAdapter adapter = new SqlDataAdapter(); <br />
connection.Open();<br />
adapter.SelectCommand = command;<br />
adapter.Fill(dtSet, "Tnumber");<br />
listBox1.DataContext = dtSet; <br />
}<br />
}<br />
<br />
private void BindXmlData()<br />
{<br />
}<br />
<br />
private void button1_Click(object sender, RoutedEventArgs e)<br />
{<br />
<br />
<br />
}<br />
}<br />
}
|
|
|
|
|
Just read some basic tutorials which ae easily available on google
himanshu
|
|
|
|
|
I did try to find but didn't get any appropriate tut aur guide..
|
|
|
|
|
string sql = "Insert into "TableName" (Column Name) values('Column Value')";
string connectionString = @"Data Source='local\SQLEXPRESS';Integrated Security=True;Pooling=False;Initial Catalog='MASTER'";
DataSet dtSet = new DataSet();
using (connection = new SqlConnection(connectionString))
{
command = new SqlCommand(sql, connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dtSet);
}
himanshu
|
|
|
|
|
Is this himanshu kashyap from amritsar??
|
|
|
|
|
|
Hi Experts
i want to enable/disable tcp/ip and name pipe of sql server 2005 using command or query
not from wizard or internally open the window or SAC(Surface area Confg.).
Can You tell me what is query/command to enable the tcp/ip and namepipe.
Dines Sharma
Thank U
|
|
|
|
|