I am writing a C# application that interfaces with SQL Server CE, but I have encountered one of the many limitations that CE has.
My database has the tables Customer
, List
, and CustomerList
. Customers can be subscribed to many lists and lists can have many customers - so I have the customerlist table as a junction table (columns are CustomerListId
, CustomerId
, ListId
- that's all).
The design is that we have a master list that will always have every customer listed in it.
So in my code I am writing a function that sets all the listed customers to be subscribed to the master list. This is my very simple SQL query:
insert into customerlist (CustomerId, ListId)
values (
(select customerid from customer),
(select 1 from list where ShortDesc='Master'))
This query does not work in SQL Server CE and I am racking my brains trying to find an alternative that does not involve a painful for-each row-by-row code. Any ideas would be greatly appreciated.