Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

SQL to insert data (Syntax)

I need to insert data to table:  HomepageIcons

The problem is with the first item ("FirmId") , which its value comes from the result of the following sql:

Select firmid from HomepageIcons where IconName = 'Cases'  --- this value should be inserted in the table row along with the rest of the values as listed below (note that 'image' value has quotes in there, is the syntax right ?  

---

Firmid = ?  (This is the value that comes from the result of the sql above)
IconName = 'Basic Training'
Linkto = 'frames.asp?leftframe=leftframe.asp&mainframe=BT/Basictraining.asp'
row = '4'
iconorder = '99'
superuseravailable = '1'
adminavailable = '1'
image = '<img src="../Images/iconusersguide.gif" border=0>'
Linktoleftframe = 'BT/Basictraining.asp'

What I need is the full sql to insert all this values  :)

Thx for the help :)
ASKER CERTIFIED SOLUTION
Avatar of jekautz
jekautz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Thanks .. I will check it out tomorrow  morning !
Avatar of Aleks

ASKER

I am trying the following:

---

INSERT  INTO HomepageIcons
        ( Firmid ,
          IconName ,
          Linkto ,
          row ,
          iconorder ,
          superuseravailable ,
          adminavailable ,
          image ,
          Linktoleftframe
        )
VALUES  ( '1' ,
          'Basic Training' ,
          'frames.asp?leftframe=leftframe.asp&mainframe=BT/Basictraining.asp' ,
          '4' ,
          '99' ,
          '1' ,
          '1' ,
          '<img src='../Images/iconusersguide.gif' border=0>' ,
          'BT/Basictraining.asp'
        )

---

I get an error on the code that has the '  it breaks the code, how can I insert a :  '  ?

line:             '<img src='../Images/iconusersguide.gif' border=0>' ,
Avatar of Aleks

ASKER

Tired this but didn't work:

 '<img src='''../Images/iconusersguide.gif''' border=0>' ,

Tried this didn't work:

 '''<img src='../Images/iconusersguide.gif' border=0>''' ,
Avatar of Aleks

ASKER

:)
if you use the code examples i gave, you do not need to worry about single quotes or escaping any other charactors