Here is quite a useful function for producing or saving only the date part of the smalldatetime datatype.
This can be useful if you only need to store the date or you need to group some results by date only.
SelectConvert([smalldatetime],floor(Convert([float],getdate(),(0))),(0))
Entries Tagged as 'SQL databases'
Date Only from SQL using Microsoft SQL Server
May 17th, 2012 · No Comments
Tags: SQL databases
Ways to counter SQL Injection
May 9th, 2012 · No Comments
Database Permissions
Set the permissions on the database username / password as tightly as possible. If you are displaying data, there is no need for the user to have insert or update permissions into the database. One solution is to have two usernames / passwords. One would have select permissions, and would be used only for [...]
Tags: SQL databases · Security Issues
Resetting admin password in PHP-eSeller
March 20th, 2012 · No Comments
The only way to reset the admin password is to do a SQL update statement on the database.
You will need to go into phpmyadmin or a similar program which can be user to administer the database tables.
The update statement that you can use is :
UPDATE ipn_tblpasswords SET userpassword = md5(‘admin’) WHERE username = ‘admin’
In this [...]
Tags: PHP-eSeller · SQL databases
SQL Server connection strings
November 10th, 2011 · No Comments
SQL ODBC connection strings
Standard Security:
Driver={SQLServer};Server=yourServerName;Database=yourDatabaseName;Uid=yourUsername;Pwd=yourPassword;
Trusted connection:
Driver={SQLServer};Server=yourServerName;Database=yourDatabaseName;Trusted_Connection=yes;
SQL OLE DB connection strings
SQL Server 2005, 2008
System.Data.OleDb.OleDbConnection
Standard Security:
Provider=SQLOLEDB;Data Source=yourServerName;Initial Catalog=yourDatabaseName;UserId=yourUsername;Password=yourPassword;
Trusted connection:
Provider=SQLOLEDB;Data Source=yourServerName;Initial Catalog=yourDatabaseName;Integrated Security=SSPI;
SQL OleDbConnection .NET strings
Standard Security:
Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;UserId=Your_Username;Password=Your_Password;
Trusted connection:
Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;Integrated Security=SSPI;
SQL SqlConnection .NET strings
Standard Security:
1. Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;UserId=Your_Username;Password=Your_Password;
2. Server=Your_Server_Name;Database=Your_Database_Name;UserID=Your_Username;Password=Your_Password;Trusted_Connection=False
Trusted connection:
1. Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;Integrated Security=SSPI;
2. Server=Your_Server_Name;Database=Your_Database_Name;Trusted_Connection=True;
Tags: SQL databases
How to identify duplicate values in a database
November 6th, 2011 · No Comments
SELECT programme_main_id
FROM dbo.para_sub_details
GROUP BY programme_main_id
HAVING (COUNT(programme_main_id) > 1)
This uses a simple SQL statement which identifies those entries which have dupliate programme_main_id
Paul
Tags: SQL databases · Uncategorized
Ways to counter SQL Injection
April 2nd, 2011 · No Comments
Here are a few suggestions to counter the problem of sql injections.
Database Permissions
Set the permissions on the database username / password as tightly as possible. If you are displaying data, there is no need for the user to have insert or update permissions into the database. One solution is to have two usernames / passwords. [...]
Tags: SQL databases
Restoring Your mySQL Database From Backup using phpMyAdmin
January 25th, 2010 · No Comments
phpMyAdmin is a program used to manipulate databases remotely through a web interface. A good hosting package will have this included.
Login to phpMyAdmin.
Create a new blank database first.
Click databases, and select the database that you will be importing your data into.
Across the top of the screen will be a row of tabs. [...]
Tags: PHP-KeyCodes · PHP-SecureArea · PHP-eSeller · SQL databases
Backing up a database using phpMyAdmin
January 25th, 2010 · No Comments
This desciption is applicable to all the applications PHP-eSeller, PHP-SecureArea and PHP-KeyCodes.
You should backup your database at regular intervals. You will then be able to restore the database if something goes wrong.
phpMyAdmin is the name of the program that you can use to manipulate databases. It is usually provided as part of you control panel [...]
Tags: PHP-KeyCodes · PHP-SecureArea · PHP-eSeller · SQL databases
Creating a mySQL Database in cPanel (new style)
April 4th, 2009 · No Comments
Log in to your Cpanel
Log into cPanel and click on the mySQL database link.
Create A New Database
Scroll down to where it says ‘new database’ and enter your choosen database name in the field and click on ‘Create Database’
MySql Account Maintenance Page
Each step in the process will take you back and forth to the mySQL Maintenace [...]
Tags: PHP-KeyCodes · PHP-SecureArea · PHP-eSeller · SQL databases
Create a mySQL database with GoDaddy hosting
March 26th, 2009 · No Comments
This describes creating a database with GoDaddy hosting
First, start by logging into your GoDaddy account:
Click on my hosting account (dropdown under “hosting”)
Click on “manage account” under the correct hosting account domain
Once you’re in the “hosting control center” click on “mysql” from the “databases” dropdown menu
Click the “create database” button
Choose MySQL version 4 or 5, and [...]
Tags: PHP-KeyCodes · PHP-SecureArea · PHP-eSeller · SQL databases