I have used this syntax to create a table
create emp(emp_id int,staff_Name varchar(10),det_Name varchar(20));
This creates a table but I cannot insert any data in the table.How can i insert data in the table.insert into emp values(100,'sridhar','programmer')
Showing posts with label varchar. Show all posts
Showing posts with label varchar. Show all posts
Thursday, March 22, 2012
Saturday, February 25, 2012
Creating a database
When creating a database using OSQL -E -I CreateDatabase.sql
I have the following in my input file:
CREATE TABLE admin
(
ID char(7),
Pwd varchar(32)
)
GO
How could I make it so that Pwd does not allow nulls and has a default value
of 'Password'?
hi Terry,
Terry Olsen wrote:
> When creating a database using OSQL -E -I CreateDatabase.sql
> I have the following in my input file:
> CREATE TABLE admin
> (
> ID char(7),
> Pwd varchar(32)
> )
> GO
> How could I make it so that Pwd does not allow nulls and has a
> default value of 'Password'?
SET NOCOUNT ON
USE tempdb
CREATE TABLE dbo.Admin (
ID varchar(7) NOT NULL ,
Pwd varchar(32) NOT NULL DEFAULT 'Password'
)
INSERT INTO dbo.Admin VALUES ('Andrea' , DEFAULT )
SELECT * FROM dbo.Admin
DROP TABLE dbo.Admin
--<--
ID Pwd
-- --
Andrea Password
please have a look at
http://msdn.microsoft.com/library/de...eate2_8g9x.asp
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.12.0 - DbaMgr ver 0.58.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
I have the following in my input file:
CREATE TABLE admin
(
ID char(7),
Pwd varchar(32)
)
GO
How could I make it so that Pwd does not allow nulls and has a default value
of 'Password'?
hi Terry,
Terry Olsen wrote:
> When creating a database using OSQL -E -I CreateDatabase.sql
> I have the following in my input file:
> CREATE TABLE admin
> (
> ID char(7),
> Pwd varchar(32)
> )
> GO
> How could I make it so that Pwd does not allow nulls and has a
> default value of 'Password'?
SET NOCOUNT ON
USE tempdb
CREATE TABLE dbo.Admin (
ID varchar(7) NOT NULL ,
Pwd varchar(32) NOT NULL DEFAULT 'Password'
)
INSERT INTO dbo.Admin VALUES ('Andrea' , DEFAULT )
SELECT * FROM dbo.Admin
DROP TABLE dbo.Admin
--<--
ID Pwd
-- --
Andrea Password
please have a look at
http://msdn.microsoft.com/library/de...eate2_8g9x.asp
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.12.0 - DbaMgr ver 0.58.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
Subscribe to:
Posts (Atom)