PreparedStatement.setDate(int parameterIndex, Date x)

Anyone knows how to set an instance of Date(long date)?
What do I put in the parameter?
Date d = new Date(????);
Anyone can advice?

1. If you want to create the object with the current date, simply use the parameterless constructor, assuming your creating an object of java.util.Date
2. If your creating an object of java.sql.Date and you want the current date in it, then you can do
java.sql.Date today = new java.sql.Date(System.currentTimeMillis());3. If your creating either of the two types of date with a specefic date set in it you could use
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(year, month, date);
Date = new Date(cal.getTime().getTime());hope I didnt leave out a possibility.... ;-)
Regards
Omer

Similar Messages

  • PreparedStatement.setDate(int, Date) problem in WHERE clause

    Hello all,
    First and foremost, thanks for the help. It is really appreciated.
    I am having the toughest time tracking down a problem with how I am handling date setting with my PreparedStatement. The kicker is that I am only having problems with the where clause date sets.
    The date is pulled out of the database, put into a string, modified, put back into a date, and then used to query via SQL.
    Data selected this way:
    "SELECT * FROM table_name"
    Data updated this way:
    "UPDATE table_name SET name = ? WHERE pk_id = ? AND pk_date = ?"
    The java.sql.Date object I use to PreparedStatement.setDate(int, Date) is exact to seconds. It works great if it is not in the where clause (eg Inserts work, Updates work without where clause) which leads me to believe there is truncation of data somewhere between setDate(int, Date) and the native SQL in Oracle 9i.
    Is that a correct assumption? How do I solve this?
    Thanks,
    John

    My assumption was correct. If a java.sql.DATE is pulled from a Oracle 9i database it may have more data in it than is allowed for in java.sql.Date. java.sql.Timestamp, on the other hand, does retain all data in the field.
    The correct code looks something like this
    prepStmt.setTimestamp(Timestamp.valueOf(timeString));
    cheers,
    John

  • PreparedStatement.setDate(new java.sql.Date(long))

    Anyone knows how to set insert a Date with Time, Day, Year into a database? I have tried using the preparedStatement.setDate(new java.sql.Date(long)) but it only inserts yyyy mm dd but I want to include time too.
    Anyone knows how here? Please advice.

    how to create an instance of Timestamp?
    new java.sql.Timestamp(????)
    What to put in the parameter?I think that I might have answered that in another one of your posts, if not could you elaborate your problem
    http://forum.java.sun.com/thread.jsp?forum=31&thread=165123

  • Prepared statement - setDate(index, sql.Date, Cal) Help!

    Hi everyone, I'm creating a form to query an Oracle table. I'm setting up the search criteria which includes a start and end date. (in this example I've just used the start date)
    I get all the search parameters into my JSP and I created the following Calendar objects:
    // Calendar creation
    Calendar startCal = Calendar.getInstance();
    startCal.set(start_year, start_month, start_day, start_hour, start_minute);
    Calendar endCal = Calendar.getInstance();
    endCal.set(end_year, end_month, end_day, end_hour, end_minute);
    //define a sql.Date value for start and end date
    java.sql.Date startDate = null;
    java.sql.Date endDate = null;I then create a string that contains my SQL statement:
    String sqlStmt = "select dateValue, value3 from someTable where dateValue >= ? and value2 = ?";In my Prepared Statement I pass in the following information:
    ps = c.prepareStatement(sqlStmt);
    ps.setDate(1, startDate, startCal);
    ps.setString(2, searchValue);My question is the following - I define the hour and minute in my Cal object - will that information get passed into my "startDate" sql.Date object? According to the API it should work (at least that's my understading of it):
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setDate(int,%20java.sql.Date,%20java.util.Calendar)
    My search does not blow up or report any errors but it never finds a match - even when I put in parameters that I know are a match.
    Any feedback is appreciated.

    I think I got it. my java.sql.Date can't be null.
    java.sql.Date startDate = null;
    java.sql.Date endDate = null;needs to be:
    java.util.Date startCalendarDate = startCal.getTime();
    java.util.Date endCalendarDate = endCal.getTime();
    java.sql.Date startDate = new java.sql.Date(startCalendarDate.getTime());
    java.sql.Date endDate = new java.sql.Date(endCalendarDate.getTime());

  • PreparedStatement setDate Help

    hi.
    I wonder what wrong with my code:
    Date tDate = new Date();
    PreparedStatement preStmt;
    String str = "UPDATE READERTRACK SET LastVisit = ?, NumTimes = ? WHERE";
    str += " TYPE = ?";
    System.out.println(str);
    preStmt = conn.prepareStatement(str);
    preStmt.clearParameters();          
    preStmt.setDate(1, tDate);     
    preStmt.setInt(2, numTime+1);
    preStmt.setString(3,getCriteria());          
    preStmt.executeUpdate();
    preStmt.close();
    conn.close();
    it give an error saying:
    cannot resolve symbol
    symbol : method setDate (int,java.util.Date)
    location: interface java.sql.PreparedStatement
    help
    thanks. :D

    Sure thing. I found I was getting all kinds of exceptions with inserting dates into SQL Server. The worst was a fractional truncation exception that happened from time to time.
    My first attempt was to insert a timestamp object using setTimestamp() method which gave me above exception. Now I use Strings for all inserts of dates using the setObject() method and haven't had a problem since. e.g.
    String date = "01-MAR-1990"
    stmt.setObject(1, date);

  • CAST Not working for me - Arithmetic overflow error converting int to data type numeric - error

    GPM is DECIMAL(5,2)
    PRICE is DECIMAL(11,4)
    COST is DECIMAL(7,2)
    Trying to update the Gross Profit Margin % field and I keep getting the "Arithmetic overflow error converting int to data type numeric" error.
    UPDATE SMEMODETAIL SET SMD_GPM = (SMD_PRICE-SMD_COST) / SMD_PRICE * 100
    FROM SMEMODETAIL WHERE SMD_PRICE<>0 AND SMD_QUANTITY<>0
    Example record:
    SMD_PRICE    SMD_COST    GPM%
    1.8500            1.62                12.4324324324324300
    I added cast and I still get the error.
    How do I format to get this to work?
    Thanks!

    Hi GBerthume,
    The error is caused by some value such as 1000.01 of the expression (SMD_PRICE-SMD_COST) / SMD_PRICE * 100 exceeds the
    precision of the column(DECIMAL(5,2)). The example data doesn't cause the overflow error for the value of the expression is 12.43 which is in the scope of DECIMAL(5,2).
    USE TestDB
    CREATE TABLE SMEMODETAIL
    SMD_PRICE DECIMAL(11,4),
    SMD_COST DECIMAL(7,2),
    SMD_GPM DECIMAL(5,2)
    INSERT INTO SMEMODETAIL(SMD_PRICE,SMD_COST) SELECT 1.8500,1.62
    UPDATE SMEMODETAIL SET SMD_GPM = (SMD_PRICE-SMD_COST) / SMD_PRICE * 100
    FROM SMEMODETAIL WHERE SMD_PRICE<>0-- AND SMD_QUANTITY<>0
    SELECT * FROM SMEMODETAIL
    DROP TABLE SMEMODETAIL
    The solution of your case can be either scale the DECIMAL(5,2) or follow the suggestion in Scott_morris-ga's to check and fix your data.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Next int.review date  in credit management

    Dear all,
    In FD33 you have a field called Next int.review date (field name NXTRV)
    This in combination with the settings that are done in OVA8 will block all new sales orders once the date in the next int. review date has expired.
    My question to you is do you know where in the sales order the block will be visible. Is that header or item level or both. Do you know in what field I can find the block in the sales order that has been triggered by the next int. review date?
    Kind regards

    For credit mgmt, we have last review date and next review date. What happens is whenever a credit limit for a customer is approved, the date on which it is approved becomes the last review date and then this limit is approved for a certain period, the date on which its validity is going to end or a day before that depending on your business requirements becomes the next review date, i.e. on that particular date again that customer's credit limit is reviewed as to whether to maintain the same limit or there is a need to make any changes to it.........
    This date has nothing to do with static or dynamic checks, i.e it is not dependent on them......
    The effect of mantaining this is whenever there is a credit check for a customer, it'll check these dates, if the next review date is in past, that limit is not effective for that customer.....
    Hope this is of some help........
    Reward, if useful......
    Regards,
    Noopur

  • Next int. review date

    Hello all,
    I have a question for you about the functionality of the u201CNext int. review dateu201D in credit management which I hope you can help me with.
    If I understand correctly then basically when the next int. review date is reached then all the sales orders that are created will be blocked. Is this correct?
    Does this apply only for new sales orders that are created or will the sales orders that were created before the next int. review date was reached blocked as well?
    If the sales orders are blocked and the next internal review date has been changed to a date in the future is there a program that unblocks all the sales orders that were blocked as result of the next int. review date?
    We are using the dynamic credit check process.
    Thanks,

    hello, friend.
    1.  you can change credit limit en masse by -
         a.  using t-code MASS and choosing Customer credit - central data, and Customer credit - status
         b.  using LSMW to automate FD32
    2.  to assign a customer as reference for credit control for several customers (let's say Customer A with credit limit of 100,000.  Customers B, C and D share in the limit), you can do the following:
         a.  execute FD32 and enter Customer B
         b.  on status page, click EDIT > CHANGE CREDIT ACCT.  a message will appear advising you to reorganize data.
         c.  on the next screen, enter Customer A in credit account.  save.
         d.  repeat for Customer C and D.
         e.  now run t-code F.28 for these customers.
          f.  when you create sales transactions, you will notice the credit data of only A is updated, while the rest will have zero.
    regards.

  • PreparedStatement.setDate(1,java.sql.Date x) problem

    I am using Sun JDBC-ODBC bridge to access MS SQL Server 2000. I have following statement:
    java.util.Date date = new java.util.Date();
    java.sql.Date expire_date = new java.sql.Date(date.getTime());
    PreparedStatement pstat = con.prepareStatement("update account set expire_date=? where userid=?");
    pstat.setDate(1,expire_date);
    pstat.setString(2,userid);
    When I ran the program, I got a SQLException error as
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional features not implemented.
    I have traced the problem happened in the statement pstat.setDate(1,expire_date). I use jdbc-odbc bridge from j2se 1.3.1.
    I appreciate any help.
    Thanks, Brian

    May I refer to a recent topic where I explained a lot about date conversion between JDBC and SQLServer?
    http://forum.java.sun.com/thread.jsp?forum=48&thread=241049
    Try how far this helps you, then ask more.

  • How to check for null int/null Date

    Heres the situation, there is an interface accepting an int value and a time/date that are not required(and are not set to anything automatically, i have no control over that part unfortunately), but I need to set up some sort of null/has value type of check to execute the setter when it does have a value, and ignore it when it doesnt. I am currently getting null pointers. here is my current set up:
    //throws null pointer as set up below, I am assuming I might want to eliminate the "getDate" off of the end and that might clear it up.
    if(data.getDate().getTime() != null)
              tempData.setDate(data.getDate().getTime());
    //Not sure on this one yet, the value doesn't get set to anything so I am assuming it automatically gets assigned something like -1.
    if(data.getId() >= 0){
              tempData.setId(data.getId());
              }

    tsdobbi wrote:
    I know data isnt null because it goes through a bunch of other tempData.set(data.get) items prior to hitting a snag on the above date I mentioned, when there is no value input for the date. and that particular null check I do there, does not work because it throws a null pointer in the if statement itself.
    i.e. it traces the null pointer to
    (if data.getDate().getTime != null) //this is the line the null pointer traces to.{color:#3D2B1F}if data is not null, then it must be the case that data.getDate() is null. Now that's what I call logic. W00t!{color}

  • Problem concerning parsing int from .dat input

    The following program takes information form a ".dat" file, stores it and manipulates it. However, I am having a weird problem. Whenever I try to parse a n int from a certain point in the file (the end of a line) I keep getting thrown a java.lang.NumberFormatException. I understand why this would be thrown if I was sending it a wrong number, but, I am not. In fact the token before the last one sends it the same number and it parses fine. Here is the problem code;
    public void getPrice(Scanner scanner)
    while(scanner.hasNextLine())
    //puts into string the next scan token
    String s = scanner.next();
    //takes the scan toke above and puts it into an editable enviroment
    stringToken = new StringTokenizer(s, " ", false);
    while(stringToken.hasMoreTokens())
    //moves position within string in file by one
    position++;
    /*Starts data orignazation by reading from each perspective field
    * 1 = day
    * 2 = day of month
    * 3 = month
    * 4 = year
    if(position == 1)
    String dayFromFile = stringToken.nextToken();
    int dayNum = Integer.parseInt(dayFromFile);
    System.out.print(days[dayNum-1] +" ");
    else if(position == 2)
    System.out.print(stringToken.nextToken() + "/");
    else if(position == 3)
    System.out.print(stringToken.nextToken() + "/");
    else if(position == 4)
    System.out.print(stringToken.nextToken() +"\n");
    //if it is in [buy] area, it prints
    else if(position == 8)
    String buy = stringToken.nextToken();
    System.out.println("Buy: " +buy );
    currentBuyPrice = Integer.parseInt(buy);
    if(currentBuyPrice < 0)
    currentBuyPrice = 0;
    if(currentBuyPrice > buyPrice)
    buyPrice += currentBuyPrice;
    if(currentBuyPrice == buyPrice)
    buyPrice +=0;
    else
    buyPrice -= currentBuyPrice;
    //if it is in [sell] area, it prints, and resets the position to zero because line is over
    else if(position == 9)
    String sell = stringToken.nextToken();
    System.out.println("Sell: " +sell);
    **currentSellPrice = Integer.valueOf(sell).intValue();;
    if(currentSellPrice < 0)
    currentSellPrice = 0;
    else if(currentSellPrice > sellPrice)
    sellPrice += currentSellPrice;
    else if(currentSellPrice == sellPrice)
    sellPrice +=0;
    else
    sellPrice -= currentSellPrice;
    scanner.nextLine();
    position = 0;
    if(scanner.hasNextLine() == false)
    System.out.println("Net change of buy price: " buyPrice "\n Net change of sell price: " +sellPrice);
    //discards all other string areas
    else
    stringToken.nextToken();
    **The problem is here. The string prints as a perfect number, no spaces or anything. I thought it could be because the number was "-1" but I tried it without the "-" and it still threw the same thing. The really weird thing is that the buy code works fine, and it parses all ints I send it fine.
    EDIT:
    Here is how the .dat looks;
    1 5 15 2006 18 26 12 -1 -1
    1 5 15 2006 18 32 20 -1 -1
    1 5 15 2006 18 38 29 -1 -1
    It is the last "-1" that can not be parsed. I tried putting an excape character at the end so it looked;
    1 5 15 2006 18 26 12 -1 -1 &
    1 5 15 2006 18 32 20 -1 -1 &
    1 5 15 2006 18 38 29 -1 -1 &
    That did nothing.

    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    public class CSE extends JFrame implements ActionListener
    //GUI COMPONENTS
    JTextField input = new JTextField(20);
    JButton submit = new JButton("submit");
    //COMPONENTS FOR DATE; OBTAINING CORRECT FOLDER
    String days[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
    Calendar calSource = Calendar.getInstance();
    int day = calSource.get(Calendar.DAY_OF_MONTH);
    int month = calSource.get(Calendar.MONTH);
    int year = calSource.get(Calendar.YEAR);
    int monthCheck [] = {Calendar.JANUARY, Calendar.FEBRUARY, Calendar.MARCH, Calendar.APRIL, Calendar.MAY, Calendar.JUNE, Calendar.JULY, Calendar.AUGUST, Calendar.SEPTEMBER, Calendar.OCTOBER, Calendar.NOVEMBER, Calendar.DECEMBER};
    int dayS;
    int monthS;
    int yearS;
    //if there is file found
    boolean proceed = false;
    //int data for analysis
    int buyPrice;
    int currentBuyPrice;
    int sellPrice;
    int currentSellPrice;
    //toold for parsing and decoding input
    String inputS = null;
    String s = null;
    StringTokenizer stringToken = null;
    Scanner scanner;
    int position = 0;
                        public CSE()
                                    super("Test CSE");
                                    setDefaultCloseOperation(EXIT_ON_CLOSE);
                                    input.setBackground(new Color(0, 80, 250));
                                    submit.addActionListener(this);
                                    getContentPane().add(input, BorderLayout.SOUTH);
                                    getContentPane().add(submit, BorderLayout.NORTH);
                                    setSize(500, 500);
                                    setVisible(true);
                                        public void actionPerformed(ActionEvent e)
                                            getMonth();
                                            inputS = input.getText();
                                            FileReader newRead = null;
                                                    try {
                                                           newRead = new FileReader(monthS +"-" +day +"-" +year +"/" +inputS +".dat");
                                                           proceed = true;
                                                        catch(FileNotFoundException f)
                                                           System.out.println("File not found");
                                                           proceed = false;
                                          if(proceed)
                                          BufferedReader bufferedReader = new BufferedReader(newRead);
                                          scanner  = new Scanner(bufferedReader);
                                          scanner.useDelimiter("\n");
                                          getPrice(scanner);
                                    public void getPrice(Scanner scanner)
                                        while(scanner.hasNextLine())
                                            //puts into string the next scan token
                                            String s = scanner.next();
                                            //takes the scan toke above and puts it into an editable enviroment
                                            stringToken = new StringTokenizer(s, " ", false);
                                            while(stringToken.hasMoreTokens())
                                                             //moves position within string in file by one
                                                               position++;
                                                           /*Starts data orignazation by reading from each perspective field
                                                            * 1 = day
                                                            * 2 = day of month
                                                            * 3 = month
                                                            * 4 = year
                                                           if(position == 1)
                                                               String dayFromFile = stringToken.nextToken();
                                                                int dayNum = Integer.parseInt(dayFromFile);
                                                              System.out.print(days[dayNum-1] +" ");
                                                           else if(position == 2)
                                                               System.out.print(stringToken.nextToken() + "/");
                                                           else if(position == 3)
                                                               System.out.print(stringToken.nextToken() + "/");
                                                            else if(position == 4)
                                                                System.out.print(stringToken.nextToken() +"\n");
                                                           //if it is in [buy] area, it prints
                                                            else if(position == 8)
                                                                String buy = stringToken.nextToken();
                                                            System.out.println("Buy: " +buy );
                                                            currentBuyPrice = Integer.parseInt(buy);
                                                            if(currentBuyPrice < 0)
                                                                currentBuyPrice = 0;
                                                            if(currentBuyPrice > buyPrice)
                                                                     buyPrice += currentBuyPrice;
                                                            if(currentBuyPrice == buyPrice)
                                                                buyPrice +=0;
                                                               else
                                                                   buyPrice -= currentBuyPrice;
                                                            //if it is in [sell] area, it prints, and resets the position to zero because line is over
                                                            else if(position == 9)
                                                                String sell = stringToken.nextToken();
                                                              System.out.println("Sell: " + sell);
                                                              currentSellPrice = Integer.valueOf(sell).intValue();;
                                                               if(currentSellPrice < 0)
                                                                   currentSellPrice = 0;
                                                               else if(currentSellPrice > sellPrice)
                                                               sellPrice += currentSellPrice;
                                                                else if(currentSellPrice == sellPrice)
                                                                sellPrice +=0;
                                                               else
                                                               sellPrice -= currentSellPrice;
                                                                scanner.nextLine();
                                                                position = 0;
                                                               if(scanner.hasNextLine() == false)
                                                                System.out.println("Net change of buy price: " +buyPrice +"\n Net change of sell price: " +sellPrice);
                                                            //discards all other string areas
                                                            else
                                                            stringToken.nextToken();
                                public void getMonth()
                                    for(int x=0; x < monthCheck.length; x++)
                                        if(month == monthCheck[x])
                                              monthS = (x+1);
                                              x = monthCheck.length;
    public static void main(String [] args)
    CSE cs = new CSE();
    }Make a folder named whatever the current date is, and put a .dat file in there with this;
    1 5 15 2006 0 3  52 -1 -1
    1 5 15 2006 0 29 52 -1 -1
    1 5 15 2006 0 36  1 -1 -1
    1 5 15 2006 0 42  9 -1 -1
    1 5 15 2006 0 48 18 -1 -1
    1 5 15 2006 0 54 29 -1 -1
    1 5 15 2006 1 0  37 -1 -1
    1 5 15 2006 1 6 44 -1 -1
    1 5 15 2006 1 12 53 -1 -1
    1 5 15 2006 1 19 1 -1 -1
    1 5 15 2006 1 25 9 -1 -1
    1 5 15 2006 1 31 18 -1 -1
    1 5 15 2006 1 37 27 -1 -1
    1 5 15 2006 1 43 37 -1 -1
    1 5 15 2006 1 49 46 -1 -1
    1 5 15 2006 1 55 53 -1 -1
    1 5 15 2006 2 2 1 -1 -1
    1 5 15 2006 2 8 10 -1 -1
    1 5 15 2006 2 14 27 -1 -1
    1 5 15 2006 2 20 37 -1 -1
    1 5 15 2006 14 12 45 -1 -1
    1 5 15 2006 14 20 36 -1 -1
    1 5 15 2006 14 26 44 -1 -1
    1 5 15 2006 14 32 52 -1 -1
    1 5 15 2006 14 39 0 -1 -1
    1 5 15 2006 14 45 8 -1 -1
    1 5 15 2006 14 51 17 -1 -1
    1 5 15 2006 14 57 26 -1 -1
    1 5 15 2006 15 3 35 -1 -1
    1 5 15 2006 15 9 43 -1 -1
    1 5 15 2006 15 15 51 -1 -1
    1 5 15 2006 15 21 59 -1 -1
    1 5 15 2006 15 28 6 -1 -1
    1 5 15 2006 15 34 15 -1 -1
    1 5 15 2006 15 40 24 -1 -1
    1 5 15 2006 15 46 33 -1 -1
    1 5 15 2006 15 52 40 -1 -1
    1 5 15 2006 15 58 48 -1 -1
    1 5 15 2006 16 4 56 -1 -1
    1 5 15 2006 16 11 5 -1 -1
    1 5 15 2006 16 17 14 -1 -1
    1 5 15 2006 16 23 24 -1 -1
    1 5 15 2006 16 29 32 -1 -1
    1 5 15 2006 16 35 39 -1 -1
    1 5 15 2006 16 41 47 -1 -1
    1 5 15 2006 16 47 55 -1 -1
    1 5 15 2006 16 54 4 -1 -1
    1 5 15 2006 17 0 13 -1 -1
    1 5 15 2006 17 6 23 -1 -1
    1 5 15 2006 17 12 31 -1 -1
    1 5 15 2006 17 18 39 -1 -1
    1 5 15 2006 17 24 46 -1 -1
    1 5 15 2006 17 30 55 -1 -1
    1 5 15 2006 17 37 3 -1 -1
    1 5 15 2006 17 43 12 -1 -1
    1 5 15 2006 17 49 20 -1 -1
    1 5 15 2006 17 55 29 -1 -1
    1 5 15 2006 18 1 36 -1 -1
    1 5 15 2006 18 7 44 -1 -1
    1 5 15 2006 18 13 53 -1 -1
    1 5 15 2006 18 20 2 -1 -1
    1 5 15 2006 18 26 12 -1 -1
    1 5 15 2006 18 32 20 -1 -1
    1 5 15 2006 18 38 29 -1 -1
    1 5 15 2006 18 44 36 -1 -1
    1 5 15 2006 18 50 45 -1 -1
    1 5 15 2006 18 56 54 -1 -1
    1 5 15 2006 19 3 3 -1 -1
    1 5 15 2006 19 9 10 -1 -1
    1 5 15 2006 19 15 18 -1 -1
    1 5 15 2006 19 21 26 -1 -1
    1 5 15 2006 19 27 34 -1 -1
    1 5 15 2006 19 33 44 -1 -1
    1 5 15 2006 19 39 53 -1 -1
    1 5 15 2006 19 46 3 -1 -1
    1 5 15 2006 19 52 12 -1 -1
    1 5 15 2006 19 58 20 -1 -1
    1 5 15 2006 20 4 30 -1 -1
    1 5 15 2006 20 10 38 -1 -1
    1 5 15 2006 20 16 50 -1 -1
    1 5 15 2006 20 23 0 -1 -1
    1 5 15 2006 20 29 9 -1 -1
    1 5 15 2006 20 35 17 -1 -1
    1 5 15 2006 20 41 24 -1 -1
    1 5 15 2006 20 47 32 -1 -1
    1 5 15 2006 20 53 40 -1 -1
    1 5 15 2006 20 59 49 -1 -1
    1 5 15 2006 21 5 59 -1 -1
    1 5 15 2006 21 12 8 -1 -1
    1 5 15 2006 21 18 16 -1 -1
    1 5 15 2006 21 24 23 -1 -1
    1 5 15 2006 21 30 31 -1 -1
    1 5 15 2006 21 36 40 -1 -1
    1 5 15 2006 21 42 49 -1 -1
    1 5 15 2006 21 48 57 -1 -1
    1 5 15 2006 21 55 5 -1 -1
    1 5 15 2006 22 1 12 -1 -1
    1 5 15 2006 22 7 20 -1 -1
    1 5 15 2006 22 13 28 -1 -1
    1 5 15 2006 22 19 38 -1 -1
    1 5 15 2006 22 25 48 -1 -1

  • Concatenate forward slash with int columns data type

    Hi,
    I'm trying to concatenate INT/TINYINT columns with '/' sign (forward slash).
    the error I get is:
    Conversion failed when converting the varchar value '/' to data type tinyint
    how can I concatenate it all together?
    Regards

    You have to convert first the int/tinyint values into varchar, before you can concatenate them
    SELECT CONVERT(varchar, MyIntColumn1) + '/' + CONVERT(varchar, MyIntColumn2)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to use a value int the DAT file as name of the PDF file

    I need to use a value present in my DAT file as name of the PDF File.
    I am using the ,u argument in the Print Agent and I know this causes the pdf document to get a generic filename.
    Please help me.
    Thanks

    See my response to this same question you posed in the Output Designer forum.
    http://www.adobeforums.com/webx/.59b585c2/0

  • Possible to print Int.Tab data in a window other than MAIN window in Script

    Hi,
      Can we print a internal table data in a window which is a VARIABLE Window in SAP Script? my requirement is not to print in MAIN Window.
    Thanks in Advance,
    Jakeer.

    Hi,
    You can do that.But main window is must.
    Create a text element and please check it maynot overflow if so data will be truncated.
    For not printing main window :
    Do one thing set the main window margint to the botom of the form.
    Then create a text element in main element
    NEW             
    NEW-PAGE        
    NEXT            
    NEW-PAGE = 'NEXT'

  • Problem of Statement and PreparedStatement

    hi
    The PreparedStatement has a metod :
    setNull(int parameterIndex, int sqlType)
    I want make a class to simulate PreparedStatement.
    String sql = "update tablename custname = ?,orderdate = ? where id = ?";
    mySimulate = new mySimulate(sql);
    mySimulate.setString(1,"myName");
    mySimulate.setNull(2,null);
    mySimulate.setInt(3,1);
    Statement st = con.createStatement() ;
    st.executeQuery(mySimulate.toString())
    now i don't know how to simulate the method of setNull(),setObject(),setTime()

    This isn't so easy because the SQL that gets returned will depend on the database you're using.
    However, I would implement this by tokenising the original SQL string using '?' as a delimiter.
    This would give you a list of SQL fragments.
    You would then need another list of SQL values that gets populated when the setXXX methods are called. Finally you would interleave the two lists to form the finished string:
    public class MySimulate
      protected static final SimpleDateFormat SQL_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy"); // Or whatever format your database accepts
      protected static final String NULL = "NVL"; // Or whatever your database accepts for null value
      protected String[] clauses;
      protected String[] values;
      public MySimulate(String sql)
        StringTokenizer st = new StringTokenizer(sql, "?", false);
        clauses = new String[st.getTokenCount()];
        values = new String[clauses.length];
        for(int idx = 0; idx < clauses.length; idx++)
          clauses[idx] = st.nextToken();
      public void setString(int idx, String str)
        // Should replace all occurrences of ' with '' first!
        values[idx] = "'" + str + "'";
      public void setDate(int idx, Date date)
        values[idx] = SQL_DATE_FORMAT.format(date);
      public void setNull(int idx)
        values[idx] = NULL;
      public void setInt(int idx, int val)
        values[idx] = String.valueOf(val);
      public String toString()
        StringBuffer b = new StringBuffer();
        for(int idx = 0; idx < clauses.length; idx++)
          b.append(clauses[idx]);
          b.append(values[idx]);
        return b.toString();
    }Something like that anyway.
    You'll have to play around with how to format your dates, escaping quotes in string values etc. You might even want to make it configurable for different databases.
    Hope it helps, though!

Maybe you are looking for