Collections:
PHP MSSQL - Making Columns to Take NULL
PHP MSSQL - How To Make a Column Nullable?
✍: Guest
Based on the testing result from the previous tutorial you can find out that there is a big difference in the column definition when running CREATE TABLE statement with mssql_query():
Now you have to modify the CREATE TABLE statement to create "fyi_links" again by adding NULL to columns: notes, counts, and time:
<?php
$con = mssql_connect('LOCALHOST','sa','FYIcenter');
mssql_select_db('FyiCenterData', $con);
# dropping an existing table
$sql = "DROP TABLE fyi_links";
$res = mssql_query($sql,$con);
print("Table fyi_links dropped.\n");
# creating a new table
$sql = "CREATE TABLE fyi_links ("
. " id INT NOT NULL"
. ", url VARCHAR(80) NOT NULL"
. ", notes VARCHAR(1024) NULL"
. ", counts INT NULL"
. ", time DATETIME NULL"
. ")";
$res = mssql_query($sql,$con);
print("Table fyi_links created.\n");
mssql_close($con);
?>
If you run this script, "fyi_links" will be dropped and created again with correct column definitions:
Table fyi_links dropped. Table fyi_links created.
⇒ PHP MSSQL - Inserting Data with NULL Values
⇐ PHP MSSQL - Inserting Data into an Existing Table
⇑ SQL Server FAQs - PHP MSSQL Functions - Managing Tables and Data Rows
2024-03-07, 1814🔥, 0💬
Popular Posts:
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How To Drop a Stored Procedure in Oracle? If there is an existing stored procedure and you don't wan...
Where to find answers to frequently asked questions I am new to Oracle database. Here is a list of f...