Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Selecting from the data value of a table

$
0
0

I have a temp table called #camps. In this table is a column called CustomData. The CustomData column stores the table names for campaigns in the database in this format client.dbo.customdata. I need to be able to get a count of how many records are in a specific table. In order to do this I would like to do something like this

Text
select count(acctno) from client.dbo.campnum

where client.dbo.campnum is supplied from the CustomData field.

Text
declare@start datetime,@end datetime,@campaignId uniqueidentifier,@campaignName varchar(250),@segment varchar(50)set @start = '2016-02-16'set @end = '2016-02-17'set @campaignId = '9FD97B9F-CB82-4C7F-91BE-50911B3319BE'set @segment = 'All'set nocount onif @start is null begin set @start = getdate() set @start = convert( datetime, convert(varchar, @start, 110 ) ) --remove time portionendif @end is null...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>