SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help me ! i can't insert data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

canhdongvang_minhanh
Starting Member

Vietnam
2 Posts

Posted - 04/11/2013 :  00:36:38  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 04/11/2013 :  00:57:35  Show Profile  Reply with Quote
--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')
Go to Top of Page

canhdongvang_minhanh
Starting Member

Vietnam
2 Posts

Posted - 04/13/2013 :  02:25:02  Show Profile  Reply with Quote
hehe tkanks you very must. i had done it

why can't i see the thanks button?

Edited by - canhdongvang_minhanh on 04/13/2013 03:08:02
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 04/15/2013 :  00:29:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000