Is there a way to insert a dynamic number of rows from within sql server (.sql script) given the value of a look up, and setting one column for each insert?
I want to attach a row with the foreign key of every row in a different table.
For instance:
table 1:
1 j k l m n 2-(fk)
2 j k l m n 3-(fk)
3 k u y k l 2-(fk)
table 2:
2 hi you
...
I am taking the values from a search form in my application to build a dynamic query:
string queryString = @"SELECT VALUE USERS FROM ProjectDBEntities.Users AS Users
WHERE ";
There are two tables in the database, Users and Photo, table Photo has a column UserId that links to the Users table. A one to many relationship exists between ...
i using the dynamic query to pass the variables
select a.TableName, COUNT(a.columnvalue) as '+'count'+' from Settings a
where a.ColumnValue in ('+ @columnvalue +') and a.Value in (' + @value +')
the @columnvalues = 'a','b','c'
@value ='comm(,)','con(:)'
how to pass this in dynamic query
any idea???
...