December 2012 | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Drop All tables in Oracle using SQL Statement

Friday

Dropping all user tables in Oracle:
                               Sometime for developer want drop all table, and this is the working example that I'm used.

Note:
  •  You need to log in to that user which you wanted to drop the tables
  •  Keep in mind, If run, it will not able to rollback

Here is the SQL Script:

BEGIN
FOR cur_rec IN (SELECT object_name, object_type
FROM user_objects
WHERE object_type IN
('TABLE',
'VIEW',
'PACKAGE',
'PROCEDURE',
'FUNCTION',
'SEQUENCE'
))
LOOP
BEGIN
IF cur_rec.object_type = 'TABLE'
THEN
EXECUTE IMMEDIATE 'DROP '
|| cur_rec.object_type
|| ' "'
|| cur_rec.object_name
|| '" CASCADE CONSTRAINTS';
ELSE
EXECUTE IMMEDIATE 'DROP '
|| cur_rec.object_type
|| ' "'
|| cur_rec.object_name
|| '"';
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( 'FAILED: DROP '
|| cur_rec.object_type
|| ' "'
|| cur_rec.object_name
|| '"'
);
END;
END LOOP;
END;


I got this solution from http://stackoverflow.com/questions/1690404/how-to-drop-all-user-tables

Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.

SQL Server connection Error: 18452 Login failed for user ‘(null)’.

I had an error that I believe a lot of new user for SQL server may face during create a new Database.

             

Below is the solution that I'm used to resolve my issue

Change the Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)”
to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.

Run following script in SQL Analyzer to change the authentication

LOGIN sa ENABLE
GO
ALTER LOGIN sa WITH PASSWORD = ‘’
GO

OR

In Object Explorer, expand Security, expand Logins, right-click 'sa', and then click Properties. On the General page, you may have to create and confirm a password for the 'sa' login. On the Status page, in the Login section, click Enabled, and then click OK.

Select one checkbox from group of checkbox using jquery

Monday

Multiple Checkbox validation in asp.net mvc 3 using jquery:

This is the sample code for select only one check box from a check box group.


function ValidateChkBox()
    {
        var selectedCheckBoxesValue = '';

        $('#DIVID').find("input:checkbox.CheckBoxClassName:checked").each(function (i, selected) {
                                                            if (selectedCheckBoxesValue.length == 0) {
                                                                selectedCheckBoxesValue += $(selected).val();
                                                            }
                                                            else {
                                                                selectedCheckBoxesValue += ',' + $(selected).val();
                                                            }});
            // Here you also get all the comma separated values if you want else use below method for it
        if(selectedCheckBoxesValue.length == 0)
        {
            alert("Select atleast one checkbox");
        }
    }

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets