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
 Basic insert question

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2007-08-30 : 10:47:09
Hi,

I'm new to using MS SQL Server 2005, having only worked with MySQL in the past.

If some kind person could please tell me what the equivelant MS SQL syntax should be for the MySQL query shown below then I can work everything else out for myself. I just need this hand up to get going on my MS SQL adventure. TIA.

Here's the query:

INSERT INTO `flexing_phs`.`flexing_stock_header` (
`record` ,
`week_starting` ,
`supplier_account` ,
`advice_no` ,
`date_recvd` ,
`firm_or_commission` ,
`comm_percent` ,
`invoice_number` ,
`invoice_date` ,
`invoice_status` ,
`tot_value_cost` ,
`tot_value_sold` ,
`tot_commission` ,
`tot_profit` ,
`carriage` ,
`comments` ,
`user_name`
)
VALUES (
NULL ,
'$saveGoodsInDate',
'$saveAccountNumber' ,
'$saveAdviceNote',
'$saveDateReceived' ,
'$saveFirmComm',
'$saveCommPercent',
NULL ,
NULL ,
NULL ,
'$saveTotalCost' ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
'$saveUserName'
);

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-30 : 10:51:49
[code]INSERT flexing_phs.flexing_stock_header
(
record,
week_starting,
supplier_account,
advice_no,
date_recvd,
firm_or_commission,
comm_percent,
invoice_number,
invoice_date,
invoice_status,
tot_value_cost,
tot_value_sold,
tot_commission,
tot_profit,
carriage,
comments,
user_name
)
VALUES (
NULL,
@saveGoodsInDate,
@saveAccountNumber,
@saveAdviceNote,
@saveDateReceived,
@saveFirmComm,
@saveCommPercent,
NULL,
NULL,
NULL,
@saveTotalCost,
NULL,
NULL,
NULL,
NULL,
NULL,
@saveUserName
)[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-30 : 10:58:15
Note that in mysql `flexing_phs` is database name
So insert query of sql server should be

INSERT flexing_phs..flexing_stock_header
.
.
.


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2007-08-30 : 11:03:12
Many thanks Peso. Now I know the answer I can go and spread the MS SQL love ..... :)
Go to Top of Page
   

- Advertisement -