Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help me ! i can't insert data

Author  Topic 

canhdongvang_minhanh
Starting Member

2 Posts

Posted - 2013-04-11 : 00:36:38
i can't insert data to column 'DT' !! plz help me
use master
go
if exists (select name from sys.databases where name='test')
drop database test
go
create database test
on primary(name='test_data', filename='C:\SQL\test_data', size=5, maxsize=10, filegrowth=1)
log on (name='test_log', filename='C:\SQL\test_log', size=5,maxsize=10, filegrowth=1)
create table test(
dt nvarchar(10) check (dt like '[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9]'
or dt like '[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9],[0-9]')
)
insert into test
values ('0123456789')


asdassad

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-11 : 00:57:35
[code]--you have given Commas(,) in the check constraint
create table test1.dbo.test1(
dt nvarchar(20) check (dt like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
or dt like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')
)
insert into test1.dbo.test1
values ('0123456789')[/code]
Go to Top of Page

canhdongvang_minhanh
Starting Member

2 Posts

Posted - 2013-04-13 : 02:25:02
hehe tkanks you very must. i had done it

why can't i see the thanks button?
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-15 : 00:29:20
quote:
Originally posted by canhdongvang_minhanh

hehe tkanks you very must. i had done it

why can't i see the thanks button?


Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -