Drop multiple tables starting with a particular word like 'asp.net'

by Admin 22. March 2012 11:59

Drop multiple tables starting with a particular word like 'asp.net'

USE [DBNAME]

GO

WHILE EXISTS(SELECT [name] FROM sys.tables WHERE [type] = 'U' and [name] like 'aspnet%')
BEGIN
DECLARE
@table_name varchar(50)
DECLARE
table_cursor CURSOR FOR SELECT [name] FROM sys.tables WHERE [type] = 'U' and [name] like 'aspnet%'
OPEN
table_cursor
FETCH
NEXT FROM table_cursor INTO @table_name
WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN
TRY
EXEC
('DROP TABLE [' + @table_name + ']')
PRINT 'Dropped Table ' + @table_name
END
TRY
BEGIN
CATCH END CATCH
FETCH
NEXT FROM table_cursor INTO @table_name
END
CLOSE
table_cursor
DEALLOCATE
table_cursor
END

Tags:

SQL Server

Delete multiple Stored Procedures in one go - SQL Server

by Admin 22. March 2012 11:59

Delete multiple Stored Procedures in one go - SQL Server

select Name + ',' from sys.objects where Type = 'P' and name like '%asp%'

Returns a procs list separated by a comma. Now copy and paste into a sql query window and prefix with drop procedure.

drop procedure aspnet_Setup_RestorePermissions,
aspnet_Setup_RemoveAllRoleMembers,
aspnet_WebEvent_LogEvent,
aspnet_Personalization_GetApplicationId,

Using this technique we can drop many stored procedures in one go

Tags:

SQL Server

Remove Identity on Column and Add Back after inserting records

by Admin 22. March 2012 11:59

Remove Identity on Column and Add Back after inserting records

BEGIN TRANSACTION

SET QUOTED_IDENTIFIER ON

SET ARITHABORT ON

SET NUMERIC_ROUNDABORT OFF

SET CONCAT_NULL_YIELDS_NULL ON

SET ANSI_NULLS ON

SET ANSI_PADDING ON

SET ANSI_WARNINGS ON

COMMIT

BEGIN TRANSACTION

GO

CREATE TABLE dbo.Tmp_OJTType

(

[otId] [int] NOT NULL,

[otReference] [varchar](50) NOT NULL,

[otTitle] [varchar](200) NOT NULL,

) ON [PRIMARY]

 

GO

IF EXISTS(SELECT * FROM dbo.OJTType)

EXEC('INSERT INTO dbo.Tmp_OJTType(otId,otReference,otTitle)

SELECT otId,otReference,otTitle FROM dbo.OJTType WITH (HOLDLOCK TABLOCKX)')

GO

DROP TABLE dbo.OJTType

GO

EXECUTE sp_rename N'dbo.Tmp_OJTType', N'OJTType', 'OBJECT'

GO

COMMIT

 

INSERT INTO dbo.OJTType(otId,otReference,otTitle)VALUES

(4,'04','Case-Study')

 

NOWSIMPLY GO TO MANAGEMENT STUDIO AND IN DESIGN MODE SET THE PRIMARY KEY BACK TO THE otId COLUMN

 

Tags:

SQL Server

Start and End Dates of a month

by Admin 13. March 2012 18:43

Start and End Dates of a month

//Month data starts on the 1st of the specified month and ends on the last day of month

DateTime firstDayOfTheMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

DateTime lastDayOfTheMonth = firstDayOfTheMonth.AddMonths(1).AddDays(-1);

Tags:

SQL Server

Get start and end date of the week

by Admin 27. February 2012 18:27

Get start and end date of the week

DateTime startOfWeek = DateTime.Today.AddDays(-1 * (int)(DateTime.Today.DayOfWeek));

DateTime endOfWeek = startOfWeek.AddDays(6);

Tags:

SQL Server

MVC4 Features at a glance

by Admin 23. February 2012 19:20

Cool features coming up on MVC4

They are over here from our very own asp.net website

http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253807

Keep watching

Tags:

Script to create Database Backup in chunks when the Database is huge

by Admin 11. February 2012 17:12

Scritpt to create Database Backup in chunks when the Database is huge

Create a Folder named DB_Backups under your C drive

Hit Run & that's it your back up DB is ready

Note: It might take some time based on the DB size

backup database [Your-Database-Name] to 

disk = 'C:\DB_Backups\backup1.bak',

disk ='C:\DB_Backups\backup2.bak',

disk ='C:\DB_Backups\backup3.bak',

disk ='C:\DB_Backups\backup4.bak' ,

disk ='C:\DB_Backups\backup5.bak' ,

disk ='C:\DB_Backups\backup6.bak' ,

disk ='C:\DB_Backups\backup7.bak',

disk ='C:\DB_Backups\backup8.bak',

disk ='C:\DB_Backups\backup9.bak',

disk ='C:\DB_Backups\backup10.bak' ,

disk ='C:\DB_Backups\backup11.bak' ,

disk ='C:\DB_Backups\backup12.bak' 

with init

Tags:

SQL Server

How to: Change the Target .NET Framework / C# Visual Studio 2010 suddenly can't see namespace?

by Admin 11. January 2012 09:19

Change the Target .NET Framework Version of an Existing Project

This procedure describes how to change the .NET Framework version target of an existing project.

To change the .NET Framework version of a project

1. In Visual Studio 2008, open the project you want to change.

2. Right-click the project in Solution Explorer and then click Properties. Doing this displays the Project Designer.

3. Go to the Target Framework drop-down list. For Visual Basic projects, click the Compile tab and then click Advanced Compile Options. The Target Framework list is in the Advanced Compiler Settings Dialog Box (Visual Basic). For Visual C# projects, the Target Framework list is on the Application tab of the Project Designer. For more information, see Application Page, Project Designer (C#).

4. In the Target Framework list, click a .NET Framework version that is different than the current one for your project.





Your project now targets the new .NET Framework version. The project will unload and then reload in the integrated development environment (IDE).
Note:
If you change the .NET Framework target to an different version, you may receive error messages if your code contains references to earlier or later assembly versions. To resolve these errors, you must manually modify the references.
 
 
General Question Regarding this

My C# WinForms solution has two projects. A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.

I'm working in .Net 4.0 for both projects.

Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL. Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.

If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.

When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.

NOTE: The comments / suggestions on this blog are from some common issues we .net developers face. All the contents of this blog are not my own. Some are from googling / binging

Tags:

Visual Studio 2010

Upper Case Shortcut SQL Server Management Studio

by Admin 5. January 2012 11:59

I always keep forgetting this so decided to post it here for people like me

select the text which you want to convert to upper case and hit CTRL+SHIFT+U

For Lower case  CTRL+SHIFT+L 

Cheers,

RV

Tags:

SQL Server

Akka

by Admin 8. June 2010 03:45

What is the Difference between Information Technology and Computer Science?

If you have an interest in computer hardware and software but you aren’t sure which career path to choose, you probably want to learn about information technology (IT) and computer science. These two rewarding careers each require a slightly different set of skills, and they each appeal to a somewhat different type of person. An IT career involves installing, organizing and maintaining computer systems as well as designing and operating networks and databases. Computer science is focused entirely on efficiently programming computers using mathematical algorithms.

An IT career doesn’t necessarily require a computer science (CS) degree, although a CS degree opens certain doors that otherwise wouldn’t be available. IT professionals typically work in a business environment installing internal networks and computer systems and perhaps programming. Computer scientists work in a wider range of environments, ranging from businesses to universities to video game design companies. Both of these careers have excellent growth potential and high salaries, with software developers somewhat ahead of IT professionals in earnings.

A Career in Computer Science

A computer science degree gives students a rigorous education in discrete mathematics and computer science theory. Most CS graduates go on to become software developers or Web programmers, and those who continue on to graduate-level schooling have the chance to do research or work in more specialized roles, such as advanced artificial intelligence programming.

With a four-year CS degree, students can find employment as programmers, software engineers or IT professionals. However, to become a software developer, graduates usually must teach themselves quite a bit of programming on their own. A CS education prepares students to choose the correct design patterns, algorithms and data structures for programs, but most students graduate knowing only one or two programming languages, usually C++, Python or Java. For most corporate programming jobs, C++ alone may suffice, but a professional software developer should know several other languages, including HTML, CSS, JavaScript, MySQL, PHP, Python and Java.

Software developer jobs are projected to grow 22 percent over the next 10 years, well above average. In 2012, the median annual salary of a developer was $93,350, with the highest-earning 10 percent making at least $138,880.

Working in Information Technology

With a two- or four-year IT degree, graduates can find work in a number of occupations, including information security, network architecture, database administration, systems administration and computer support. However, some of these jobs require advanced computer science and programming knowledge, so graduates must enroll in specialized programs or take elective courses. For example, information security requires knowledge of discrete math and algorithms, and database administration requires knowledge of programming. Also, information security analysts usually have certifications, such as ISC or CISSP.

In general, IT professionals need to stay abreast of new technology, and they must be very familiar with how to use operating systems and server software, including Linux, Apache, OpenSSL, Windows Server, Oracle, MySQL and Microsoft SQL Server. IT jobs are expected to increase 15 to 37 percent over the next ten years, with salaries ranging from $48,900 to $91,000, depending on experience and level of education.

While IT and CS degrees can lead to similar jobs, the differences between the two are quite pronounced. IT professionals should enjoy installing computer systems, using software and maintaining networks and databases, while computer scientists should enjoy mathematics and software design. In general, the relationship between information technology and computer science is quite close and interdependent.

 

akka

Tags:

The launch of the uk replica watches new timepiece series undoubtedly symbolizes the replica watches history of the brand, and the classic hublot replica watches design explains the mission of the replica watches uk brand's precision watchmaking.

TextBox

Tag cloud

    RecentPosts