How to add a check constraint to a column to accept values in the following format: "L214"?
All I could come up with is this:
check (column_name like '____');
But That doesn't enforce the first character to be a letter and the other three to be numbers.
Hi,
"PS: Why the f***you have so many subforums here?"
Because it is much easier to seperate and let experts answer to specific details of SQL Server. SQL Server is not a small product as many people think ;-)
Here is the solution:
CREATe table SampleA (A INT, B VARCHAR(MAX) CHECK (B LIKE '[A-Z][0-9][0-9][0-9]'))
INSERT INTO SampleA VALUES (1,'0000')
Msg 547, Level 16, State 0, Line 2
The INSERT statement conflicted with the CHECK constraint "CK__SampleA__B__38B96646". The conflict occurred in database "master", table "dbo.SampleA", column 'B'.
The statement has been terminated.
INSERT INTO SampleA VALUES (1,'L000')
--(1 row(s) affected)
INSERT INTO SampleA VALUES (1,'L0001')
Msg 547, Level 16, State 0, Line 2
The INSERT statement conflicted with the CHECK constraint "CK__SampleA__B__38B96646". The conflict occurred in database "master", table "dbo.SampleA", column 'B'.
The statement has been terminated.
-Jens
Jens K. Suessmeyer http://blogs.msdn.com/Jenss
Similar Messages
-
Reg:How to add availability check in sales view
hi all
How to add availability check in sales view
regards
JKHI Janardan..
Check out the help.sap link for Availability check. It has a lot of info.
http://help.sap.com/saphelp_erp2005/helpdata/en/6b/2785347860ea35e10000009b38f83b/frameset.htm
If it helps Reward with points..
Regards Rk -
How to add authorisation check to a program?
Hi all :
Could you please tell me how to add authorisation check to a program?
Thanks a lot.Hi,
Check SAP help for authority-check. You can search on SDN on that.
AUTHORITY-CHECK
Basic form
AUTHORITY-CHECK OBJECT object
ID name1 FIELD f1
ID name2 FIELD f2
ID name10 FIELD f10.
Thanks
Nidhi -
How to modify a CHECK constraint.
We need to modify a check constraint to allow new values. Is there a way we can modify the existing constraint or should we drop and recreate including new values.
Example:
We have a table SLOG and SNO is a column accepting numeric values. Currently there is a constraint on this column so that it accepts values of 1,2,3,4. Now I want to insert a value of 5 to this column. Since there is a CHECK constraint on this column it prevents the value of 5.
So the constraint needs to be modified. Is there a way we can modify the constraint using a DDL command (like ALTER TABLE) or should I drop and re create the constraint.
Thanks in advance.
BalajiHello,
Is there a way we can modify the constraint using a DDL command You can just MODIFY the state of your constraint ( constraint_state ).
So, if you want to modify the definition of your constraint you have to drop and create the CHECK constraint with its new definition.
Sorry, when I was writing my post, I didn't see the question was already answered.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Jul 11, 2010 11:04 AM -
How to add new row and update existing rows at a time form the upload file
hi
How to add new row and update existing rows at a time form the upload file
example:ztable(existing table)
bcent smh nsmh valid date
0001112465 7.4 26.06.2007
0001112466 7.5 26.06.2007
000111801 7.6 26.06.2007
1982 7.8 26.06.2007
Flat file structure
bcent nsmh valid date
0001112465 7.8 26.06.2007 ( update into above table in nsmh)
0001112466 7.9 26.06.2007 ( update into above table in nsmh)
000111801 7.6 26.06.2007 ( update into above table in nsmh
1985 11 26.06.2007 new row it should insert in table
thanks,
Sivagopal RHi,
First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
Then :
Loop at it.
*insert or modify as per your requirement.
Endloop.
Regards,
Srilatha. -
Hi all,
How can I add a check box in a interactive report???This link will help you
http://docs.oracle.com/cd/E1437301/apirefs.32/e13369/apex_item.htm_ -
How to add a check if entered number is even
hi!
I need some help. I need user to enter the size of the figure to be printed out. It has to ba an even number (otherwise it will print out with error). I need to add a check if entered size is an even number, otherwise display an error message and prompt user for entering the size again. If it is an even number the program should proceed and print out a figure. Any suggestions for the piece of code I need to add? Many thanks in advance!
import java.util.*;
public class Question2 {
public int Size;
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Please enter the size of a triangle you want to print out (it has to be an even number): ");
int Size = keyboard.nextInt();{
if (Size%2==0){
line(Size);
drawtop(Size);
middleline(Size);
drawbtm(Size);
line(Size);
public static void line(int Size) {
System.out.print("|");
for (int i = 1; i <= Size / 2; i++) {
System.out.print("-");
System.out.print("*");
for (int i = 1; i <= Size / 2; i++) {
System.out.print("-");
System.out.print("|");
System.out.println(" ");
public static void drawtop(int Size) {
for (int line = 1; line <= Size / 2; line++) {
System.out.print("|");
for (int space = 1; space <= Size / 2 - line; space++) {
System.out.print(" ");
for (int star = 1; star <= (line * 2 + 1); star++) {
System.out.print("*");
for (int space = 1; space <= Size / 2 - line; space++) {
System.out.print(" ");
System.out.println("|");
public static void middleline(int Size) {
System.out.print("*");
for (int i = 1; i <= Size / 2; i++) {
System.out.print("**");
System.out.println("**");
public static void drawbtm(int Size) {
for (int line = 1; line <= Size / 2; line++) {
System.out.print("|");
for (int space = 1; space <= line - 1; space++) {
System.out.print(" ");
for (int star = -1; star <= (2 * Size / 2 - 2 * line) + 1; star++) {
System.out.print("*");
for (int space = 1; space <= line - 1; space++) {
System.out.print(" ");
System.out.println("|");
}Its really unbelievable that if you have written the code of printing triangles by yourself, how you got stuck at a trivial problem like this. Please just dont copy and paste the code for completing your assignments.
Anyway the solution is trivial and I am giving you a work-through-:
Think what the if condition is doing in the below code :
if (Size%2==0){
} It does nothing.
You need a condition in which to print a message to ask user to input an even number and ask again if the number is not even. Doesnt this look like that u need a loop, And you dont know the how many times to loop but you do know when to end the loop. SO you need a WHILE loop with appropriate condition checked of even number.
Now I hope you can complete the program. -
How to add field length constraints when using an existing JavaBean model
Within our current project we used a O/R mapping tool to generate our JavaBean model. For e.g.
<b>public class Person{
private String name; ...getName() ...setName(...)
}</b>
The whole model is used within our Web Dynpro project. Now it's a requirement to implement field length constraints. Normally this is no problem using ISimpleType like the following:
<b>attributeInfo = wdContext.nodePerson().getNodeInfo().getAttribute
(IPrivate...IPersonElement.NAME);
ISimpleTypeModifiable type = attributeInfo.getModifiableSimpleType();
type.setLength(60);</b>
But we've got an runtime exception that it is not allowed to modify the models datatype:
com.sap.tc.webdynpro.progmodel.context.ContextException: AttributeInfo
<b>(Basics.Person.name): must not modify the datatype of a mapped attribute</b>
at
com.sap.tc.webdynpro.progmodel.context.AttributeInfo.getModifiableSimpleType
(AttributeInfo.java:337)
The question is how could a workaround look like. Or is there nothing like that and we have to build a dictionary type tier upon our JavaBean model. Any ideas ?
thx,
s.w.Sabine,
You may:
1. Import JavaBeans model
2. Create DDIC type with necessary constarints (string-based, max. length 60)
3. Open editor for target model class and change type of property.
See my blog /people/valery.silaev/blog/2005/06/29/apojo--almostplain-old-java-objects-as-model (section "Tweaking model classes") for details.
Valery Silaev
EPAM Systems
http://www.NetWeaverTeam.com -
How to create this check constraint
create table emplt
( emplt_pk number,
indvl_pk number,
start_dt date,
end_dt date,
lct_fl char(1),
sup_fl char(1),
br_pk number,
nro_pk number,
default_fl char(1) default 'N' );
INSERT INTO emplt
values(
1001, 101, to_date('01-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',123,NULL,NULL );
INSERT INTO emplt
values(
1002, 101, to_date('02-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',NULL,0001,NULL );
INSERT INTO emplt
values(
1003, 102, to_date('02-01-2005', 'MM-DD-YYYY' ), NULL, 'Y','N',NULL,0001,NULL );
Is it possible to create a check constraint on this table that enforces that for a given indvl_pk, br_pk and nro_pk
there is only one row with dflt_fl = 'Y'?
Thanks in advance!Say,
SQL> create unique index empli_ui on emplt(case default_fl when 'Y' then indvl_pk end,
2 case default_fl when 'Y' then br_pk end,
3 case default_fl when 'Y' then nro_pk end
4 )
5 /
 
Index created.
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(1,2,3,'J');
 
1 row created.
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(1,2,3,'J');
 
1 row created.
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(3,2,1,'A');
 
1 row created.
 
SQL>
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(3,2,1,'A');
 
1 row created.
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(3,2,1,'Y');
 
1 row created.
 
SQL>
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(3,2,1,'Y');
insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.EMPLI_UI) violated
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(1,2,3,'Y');
 
1 row created.
 
SQL> insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
2 values(1,2,3,'Y');
insert into emplt (indvl_pk,br_pk,nro_pk,default_fl)
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.EMPLI_UI) violatedRgds. -
How to add a button as a report column
Hi everyone,
I am trying to add a button in a report as a column, thus, as the button press, one of column at current row of the report will be filled. Does anyone know how to do it?
I knew I can do check box as a report column and create a button to process it But request hopes just one button for each row as result.
Thanks!
XWI am not sure what you are trying to do exactly. Adding a button is something you can do for sure in a report ( make the PK column a link and define the link image as a button ), but am not sur what you want the button to do, is it something like <edit> that when you click on it it takes you to another page (form) to edit that record info ? if yes then this is also doable for sure....let me know
Sam -
Crash of Oracle XE when check constraint uses in-operator with desc. values
ORA-03113 and other errors in conjunction with lost of connection occur in Oracle XE under the following conditions:
/* Crash (values of check constraint in descending order) */
DROP TABLE CRASHTEST CASCADE CONSTRAINTS;
CREATE TABLE CRASHTEST
CRASHTEST_ID NUMBER(9),
CRASHTEST_OK NUMBER(1) DEFAULT 0
ALTER TABLE CRASHTEST ADD (CONSTRAINT CRASHTEST_CK CHECK (CRASHTEST_OK IN (0,-1)));
INSERT INTO CRASHTEST (CRASHTEST_ID, CRASHTEST_OK) VALUES (1, 0);
INSERT INTO CRASHTEST (CRASHTEST_ID, CRASHTEST_OK) VALUES (2, -1);
COMMIT;
SELECT * FROM CRASHTEST WHERE CRASHTEST_OK = 0;
If all values of the in-clause within the check constraint are entered in ascending order, no error occurs:
/* No Crash (values of check constraint in ascending order) */
DROP TABLE CRASHTEST CASCADE CONSTRAINTS;
CREATE TABLE CRASHTEST
CRASHTEST_ID NUMBER(9),
CRASHTEST_OK NUMBER(1) DEFAULT 0
ALTER TABLE CRASHTEST ADD (CONSTRAINT CRASHTEST_CK CHECK (CRASHTEST_OK IN (-1,0)));
INSERT INTO CRASHTEST (CRASHTEST_ID, CRASHTEST_OK) VALUES (1, 0);
INSERT INTO CRASHTEST (CRASHTEST_ID, CRASHTEST_OK) VALUES (2, -1);
COMMIT;
SELECT * FROM CRASHTEST WHERE CRASHTEST_OK = 0;
Especially interesting is the fact, that the error is caused by a check constraint in conjunction with a select statement!
Hopefully, there are no other hidden bombs stealing my time...
Have a nice day,
SvenIt might be interesting to post that in the XE forum to notify Oracle developers and XE users.
Oracle Database Express Edition (XE)
C. -
Post Author: hteoh
CA Forum: Publishing
I have an BO related issue. I tried to schedule a smtp event in BO to email the report output as Excel. Since this report will go to different users, I unchecked the Use the Job Server's defaults (CHECK BOX). For some reason, I can't check the Add Attachment(CHECK BOX). I received the email but without attachement. Do you know why I can't use attachment. The SMTP event works perfectly if I check Use the Job Server's defaults.Hi!
Use the below code to populate the Sender and receiver mail ids:
DATA GV_SENDER TYPE SWC_OBJECT.
DATA GV_SENDER_ID LIKE SWOTOBJID.
SWC_CONTAINER LT_CONTAINER.
reset data for CTCV
CALL FUNCTION 'CTCV_INIT_USER_DATA'.
Create sender using sender mail address from new table
SWC_CLEAR_CONTAINER LT_CONTAINER.
SWC_CREATE_OBJECT GV_SENDER 'RECIPIENT' SPACE.
SWC_SET_ELEMENT LT_CONTAINER 'AddressString'
ZMAIL-SENDER.
SWC_SET_ELEMENT LT_CONTAINER 'TypeID' 'B'.
SWC_CALL_METHOD GV_SENDER 'CreateAddress' LT_CONTAINER.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
RAISING SENDER_CREATION_FAILED.
ENDIF.
SWC_OBJECT_TO_PERSISTENT GV_SENDER GV_SENDER_ID.
Similarly you can create the recipient mail id. Pass the GV_SENDER_ID to OPEN_FORM.
Cheers! -
Max number of CHECK constraints on a column in Oracle9i?
What is the maximum number of CHECK constraints that can be defined on a column when creating a table in Oracle 9i database?
Also could some one tell me what are the limitations on CHECK constraints?Well, in Oracle 8.1.7 documentaion it is stated that number of constraints is also unlimited. I haven't such a database now to test but here is a little test for Oracle 9iR2
SQL> drop table test;
Table dropped.
SQL> create table test (a number
2 check (a > 1)
3 check (a > 2)
4 check (a > 3)
5 check (a > 4)
6 check (a > 5)
7 check (a > 6)
8 check (a > 7)
9 check (a > 8)
10 check (a > 9)
11 check (a > 10)
12 check (a > 11)
13 check (a > 12)
14 check (a > 13)
15 check (a > 14)
16 check (a > 15)
17 check (a > 16)
18 check (a > 17)
19 check (a > 18)
20 check (a > 19)
21 check (a > 20)
22 )
23 /
Table created. -
How to add a Picklist/Drop down in a page with values (Without Personaliz)
hi,
i am very very new to OAF ....please help me out on the below requirement....
Please suggest me how to add a pick list/drop down field to a page, with some values. (without personalization)
And the second one is when ever i'll chose a value from the drop down the page will reload and display a message on the page.(messages are different for the different values)
Thanks
PrakashPrakash
As mentioned by Anil you can use the above link for new poplist generation through extension. As far as reloading the page in that case you need to make use of PPR for that item.Do refer dev guide for more details
You can use below code for creating poplist in processRequest of your extended controller
OAMessageChoiceBean mcb = (OAMessageChoiceBean) createWebBean(pageContext, MESSAGE_CHOICE_BEAN);
mcb.setPickListViewUsageName("TestVO");
mcb.setListValueAttribute("LookupCode");
mcb.setListDisplayAttribute("Meaning" );
mcb.setID("test");
mcib.setFireActionForSubmit ("event1",null,null,false, false);//This is event that cause reload of pageYou can handle the event in pfr method
if("event1".equals(pageContext.getParameter("event")))
}Thanks
AJ -
How to add multiple presets to responsive design view without having to resize the screen each time
I want to be able to add multiple screen size presets to the responsive design view capability but don't want to have to resize the screen and add each one individually via the custom preset function.
Have seen that some posts on the internet (http://g-liu.com/blog/2013/08/firefox-rdm-presets/) that say this can be done but cannot find where the config is held in ver 26.0?You can also do the opposite and create custom settings in the responsive design mode window.
You can hold down the Shift key and drag the borders via the (right border, bottom border, bottom right corner) resize icons to get specific dimensions and give the current custom setting a name to add them as a preset.
This will add the preset to the devtools.responsiveUI.presets pref.
See also my post here for a bookmarklet.
*[[/questions/957590]]
You can paste the current value of the pref in the prompt to see a list of currently defined presets.<br />
You can add a new preset by entering the width,height,name values in the prompt.<br />
Copy the new preset list to the pref.
<pre><nowiki>javascript:(function(){
function rdObj(w,h,n){with(this){key=w+"x"+h;if(n)name=n;width=w;height=h;}}
rdObj.prototype={key:"",name:"",width:"",height:""};
var n={},p='<width>x<height> <name> OR width,height,name',rd=[];
while(p!=null){
p=prompt(p,JSON.stringify(rd));
if(/^(\d{3,4})[,x](\d{3,4})([, ](.+))?$/.test(p)){
n=new rdObj(RegExp.$1,RegExp.$2,RegExp.$4);rd.push(n);
}else{try{rd=JSON.parse(p);}catch(e){}}
}})()</nowiki></pre>
Maybe you are looking for
-
i have purchased itunes match but the cloud will not load on my ipad 4.it works on my iphone 5 & it originally worked on my ipad.the only music that will show up is stuff that i bought from the itunes store.any ideas on how to get this to work?
-
Service Tax Register -- Fieldname " Kind Of Service".
Hello All, I am an abaper and i need to create a Zee Report for Service Tax Register as there is no standard report for it. I am stuck at a place , I need to know which table contains the entry for " Kind Of Service" . I mean the ser
-
Migrating from suite 9.2 to 9.3.1
Hello forum, i'm planning to upgrate a old hyperion suite v9.2 to v9.3.1. I'm not going to update the old server but to create a new one with a brand new installation on it (and then "move" my objects). Hyperion Products: - Interactive Reporting (dat
-
Urgent : Problem in passing CLOB object in jdbc call to stored procedure
i have written a simple program which is enclosed along in which I have insert set value of the CLOB object of a table through the JDBC callablestatement and i m getting error "cannot perform operation with LOB buffering enabled". so please check the
-
Updation of 'Loan Amount Paid' in IT 0045
Hi experts, I have a doubt regarding the updation of 'Loan Amount Paid' field in infotype 0045 (PA30). I see that this field value is not directly stored in PA0045 table. The reference structure for this field is Q0045-PAYLO field. can anyone pls te