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.
| Author |
Topic |
|
kabucek
Starting Member
7 Posts |
Posted - 2009-04-23 : 12:23:30
|
| hello,I have this query for creating one code at a timeINSERT INTO `database1`.`table1` (`couponCode`,`pageCount`)VALUES ('promo-001002', '2');but this will create only one code.I need a query that will create 200 codes with starting number "-001002".Is there a way to do it?Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-23 : 12:30:35
|
Are you using MySQL?INSERT Table1SELECT 'promo-' + REPLACE(STR(1002 + Number, 6, 0), ' ', '0')FROM master..spt_valuesWHERE type = 'P' and number <= 199 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
kabucek
Starting Member
7 Posts |
Posted - 2009-04-23 : 12:37:50
|
| OK,but what if I have to provide another values, like:`allowedUseCount` ,`cancelledFlag` ,`couponCode` ,`creationTime` ,`expirationTime` ,`itemID` ,`pageCount` ,`regPromoCodeString` ,`sourceItemID` ,`sourceProcessName` ,`storePromoCodeString` ,`usedCount` ,`useHistory` ,`userID`How can your query be implemented?Thanks |
 |
|
|
kabucek
Starting Member
7 Posts |
Posted - 2009-04-23 : 12:42:55
|
| but they all can be null |
 |
|
|
|
|
|
|
|