So you want to delete all the contents of the tables in your MS SQL database. You could drop and create the database. You could also drop and create the tables within the database. Then, you could iterate through all the tables in the INFORMATION_SCHEMA and delete all the rows with a TSQL script.
Here is the script I used:
USE [YourDatabase];
GO
SET NOCOUNT ON;
DECLARE @MyTableName varchar(100);
DECLARE MyCursor CURSOR
FOR SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_CATALOG = 'YourDatabase' AND TABLE_SCHEMA = 'dbo';
OPEN MyCursor;
FETCH NEXT FROM MyCursor INTO @MyTableName;
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC ('DELETE FROM ' + @MyTableName);
FETCH NEXT FROM MyCursor INTO @MyTableName;
END;
CLOSE MyCursor;
DEALLOCATE MyCursor;
Various posts mostly about technology including iPhone, Windows, and programming, but occasional posts about life
Tuesday, November 29, 2011
Thursday, September 22, 2011
Tuesday, August 23, 2011
SQL Server Full-Text Searching
Sometimes, a blog will contain information you wrote on a topic. Other times, a blog will be a posting about what others have already put together.
This post is the latter.
Recently, the opportunity arose to research how to search binary data in a database. The constraints were the document was stored in the table and it needed to work with SQL Server or Oracle. This post will, focus mostly on SQL Server.
This article shows in great detail how to setup the full-text indexing and provides great explanation as to many of the options within the syntax.
The article uses the Adventure Works database. If you need the Adventure Works database.
Then, after this was tested out, this article was found on Google type searching within a SQL Server.
And finally, some information on Google searching.
All these links were last tested: 23 Aug 2011.
This post is the latter.
Recently, the opportunity arose to research how to search binary data in a database. The constraints were the document was stored in the table and it needed to work with SQL Server or Oracle. This post will, focus mostly on SQL Server.
This article shows in great detail how to setup the full-text indexing and provides great explanation as to many of the options within the syntax.
The article uses the Adventure Works database. If you need the Adventure Works database.
Then, after this was tested out, this article was found on Google type searching within a SQL Server.
And finally, some information on Google searching.
All these links were last tested: 23 Aug 2011.
Friday, August 19, 2011
Delphi Sets
A simple example of doing enumerator sets in Delphi. There are several other examples available, I will provide links at the end of this post.
1) Declare an enumerated type:
TeDaysOfWeek = (eDoWMonday, eDoWTuesday, eDoWWednesday, eDoWThursday, eDoWFriday, eDoWSaturday, eDoWSunday);
2) Declare a set of the enumerated type:
TeDaysOfWeekSet = set of TeDaysOfWeek;
3) Declare a variable to work with the set:
var
eDOWSetWork: TeDaysOfWeekSet ;
4) Add items to the working set. Say the application is indicating what days the doctor is available:
// sets the set to empty
eDOWSetWork := [];
// add values to the set
if (some_boolean_values) then
begin
eDOWSetWork := eDOWSetWork + [eDoWMonday, eDoWTuesday];
end;
if (some_other_condition) then
begin
eDOWSetWork := eDOWSetWork + [eDoWWednesday];
end;
What you are doing with the "set = set + enumerator" is adding values into the set. You could also set the set:
eDOWSetWork := [eDoWWednesday];
This would replace any values in the set with just eDoWWednesday.
This sets the set for use, now we need to use it for comparison or other behavior:
5) Implement behavior:
procedure DoSomething(p_eDOWSetWork: TeDaysOfWeekSet);
begin
if (eDoWWednesday in p_eDOWSetWork) then
begin
end;
end;
Other links for sets:
http://delphi.about.com/od/beginners/a/delphi_set_type.htm
http://www.delphibasics.co.uk/Article.asp?Name=Sets
Sets in Delphi Prism: http://prismwiki.codegear.com/en/Sets
1) Declare an enumerated type:
TeDaysOfWeek = (eDoWMonday, eDoWTuesday, eDoWWednesday, eDoWThursday, eDoWFriday, eDoWSaturday, eDoWSunday);
2) Declare a set of the enumerated type:
TeDaysOfWeekSet = set of TeDaysOfWeek;
3) Declare a variable to work with the set:
var
eDOWSetWork: TeDaysOfWeekSet ;
4) Add items to the working set. Say the application is indicating what days the doctor is available:
// sets the set to empty
eDOWSetWork := [];
// add values to the set
if (some_boolean_values) then
begin
eDOWSetWork := eDOWSetWork + [eDoWMonday, eDoWTuesday];
end;
if (some_other_condition) then
begin
eDOWSetWork := eDOWSetWork + [eDoWWednesday];
end;
What you are doing with the "set = set + enumerator" is adding values into the set. You could also set the set:
eDOWSetWork := [eDoWWednesday];
This would replace any values in the set with just eDoWWednesday.
This sets the set for use, now we need to use it for comparison or other behavior:
5) Implement behavior:
procedure DoSomething(p_eDOWSetWork: TeDaysOfWeekSet);
begin
if (eDoWWednesday in p_eDOWSetWork) then
begin
end;
end;
Other links for sets:
http://delphi.about.com/od/beginners/a/delphi_set_type.htm
http://www.delphibasics.co.uk/Article.asp?Name=Sets
Sets in Delphi Prism: http://prismwiki.codegear.com/en/Sets
Friday, August 12, 2011
Move to Top of Page
Tap the bar at the top of the iPhone page, whatever the page to return to the top - the gray part in this image:
Home Button and More
Today's tip is something my kids showed me the other day.
Your iPhone and other i Devices often leave apps open - even after you "close" the apps. By close, I mean you are no longer using the app. By leave open, I mean the app is still running, you do not see the app running.
Why close an app? When an app is open, though not visible, it is still using resources on the device. It may be communicating with the Internet or other apps and devices, using up battery and possibly other resoruces.
To see what apps are open and running, hit the Home button twice. On the bottom, you will now see a list of apps currently open.
To close the apps, hold down an icon on the bottom row until you see a "-" appear. When you see the "-" appear, touch the "-" icon and the app will close. This will appear as though you are deleting the app from the device, but it will only be closing the app.
Shopping Apps
ShopSavvy
Frucall
Postabon
Point Inside
Coupon Sherpa
Thursday, August 11, 2011
Delphi Utilizing Templates
http://stackoverflow.com/questions/7030663/delphi-utilizing-templates
Why write it twice?
Why write it twice?
Subscribe to:
Posts (Atom)