Selecting Dynamic Columns

Jul 12, 2004

I have the following Tables:

Table1: Row1
----------------------------------
Name Gary
Garbage1 A
Garbage2 B

Table2: Row1 Row2 Row3
------------------------------------------------------------------
Name Gary Gary Gary
Value 1 2 3
Desc Day Afternoon Night

Table1 has a 1 to Many relationship with Table2

Id Like to have the select statement Return the data as follows:

Gary,A,B,Day,1,Afternoon,2,Night,3

not like this:
Gary A,B,Day,1
Gary A,B,Afternoon,2
Gary A,B,Night,3

Any Ideas?

View 3 Replies


ADVERTISEMENT

Importing Excel Sheet Which Have Dynamic Column Name And Dynamic Number Of Columns

Aug 25, 2007

Hi Craig/Kamal,

I got your email address from your web cast. I really enjoyed the web cast and found it to be
very informative.

Our company is planning to use SSIS (VS 2005 / SQL Server 2005). I have a quick question
regarding the product. I have looked for the information on the web, but was not able to find
relevant information.

We are getting Source data from two of our client in the form of Excel Sheet. These Excel sheets
Are generated using reporting services. On examining the excel sheet, I found out that the name
Of the columns contain data itself, so the names are not static such as Jan 2007 Sales, Feb 2007 Sales etc etc.
And even the number of columns are not static. It depends upon the range of date selected by the user.

I wanted to know, if there is a way to import Excel sheet using Integration Services by defining the position
Of column, instead of column name and I am not sure if there is a way for me to import excel with dynamic
Number of columns.

Your help in this respect is highly appreciated!

Thanks,


Hi Anthony, I am glad the Web cast was helpful.

Kamal and I have both moved on to other teams in MSFT and I am a little rusty in that area, though in general dynamic numbers of columns in any format is always tricky. I am just assuming its not feasible for you to try and get the source for SSIS a little closer to home, e.g. rather than using Excel output from Reporting Services, use the same/some form of the query/data source that RS is using.

I suggest you post a question on the SSIS forum on MSDN and you should get some good answers.
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1

Thanks



Craig Guyer
SQL Server Reporting Services

View 12 Replies View Related

T-SQL (SS2K8) :: How To Add Inline TVF With Dynamic Columns From CRL Dynamic Pivot

Mar 9, 2015

I have tried building an Inline TVF, as I assume this is how it would be used on the DB; however, I am receiving the following error on my code, I must be missing a step somewhere, as I've never done this before. I'm lost on how to implement this clr function on my db?

Error:
Msg 156, Level 15, State 1, Procedure clrDynamicPivot, Line 18
Incorrect syntax near the keyword 'external'.
CREATE FUNCTION clrDynamicPivot
(
-- Add the parameters for the function here
@query nvarchar(4000),
@pivotColumn nvarchar(4000),

[code]....

View 1 Replies View Related

Selecting From A Dynamic Table Name

Sep 25, 2015

I've got an update statement with a subquery (I'll post the code further down) that I need to either make dynamic or do something else to make sure it does what I want.

The query is as follows:-
UPDATE dbo.tbl_Process_List_Control_Table
SET LastUpdateDateTime = (
SELECT ISNULL(MAX([LatestRowUpdateDateTime]), @LastUpdateDateTime)
FROM [wtbl_Process_List_Patient]
)
WHERE ProcessList = @ProcessName
This is a called proc with the following parameters:-
@LastUpdateDateTime is the date of the last record to be loaded
@ProcessName is the name of the process that was started/finished.

I need to make [wtbl_Process_List_Patient] dynamic so it looks at a different table based on a passed parameter.I've tried making the whole thing dynamic but it states I need to declare @LastUpdateDateTime which I can't see how to do as it's already passed to the proc (as is the process name).

View 6 Replies View Related

T-SQL (SS2K8) :: Converting Row Values To Columns With Dynamic Columns

Jun 11, 2015

Basically, I'm given a daily schedule on two separate rows for shift 1 and shift 2 for the same employee, I'm trying to align both shifts in one row as shown below in 'My desired results' section.

Sample Data:

;WITH SampleData ([ColumnA], [ColumnB], [ColumnC], [ColumnD]) AS
(
SELECT 5060,'04/30/2015','05:30', '08:30'
UNION ALL SELECT 5060, '04/30/2015','13:30', '15:30'
UNION ALL SELECT 5060,'05/02/2015','05:30', '08:30'
UNION ALL SELECT 5060, '05/02/2015','13:30', '15:30'

[Code] ....

The results from the above are as follows:

columnAcolumnB SampleTitle1 SampleTitle2 SampleTitle3 SampleTitle4
506004/30/201505:30 NULL NULL NULL
506004/30/201513:30 15:30 NULL NULL
506005/02/201505:30 NULL NULL NULL
506005/02/201513:30 15:30 NULL NULL

My desired results with desired headers are as follows:

PERSONSTARTDATE STARTIME1 ENDTIME1 STARTTIME2 ENDTIME2
506004/30/2015 05:30 08:30 13:30 15:30
506005/02/2015 05:30 08:30 13:30 15:30

View 3 Replies View Related

More Selecting Into Local Variable With Dynamic Select...

May 25, 2004

Not wishing to derail the other recent thread on loading a local variable, I've posted this query (hee,hee,hee...I kill me) on a separate thread...though I think I am trying to do something similar...that is to build a dynamic select statement, but return a count of the rows it finds/doesn't find to a local variable...using the (amazingly timely) responses above, I tried this:

Note that the local variables @TargetDate and @TLevel are necessary because they are being passed into the procedure as variables....

DECLARE @SQLCmd varchar(256)
DECLARE @TargetDate smalldatetime
DECLARE @TLevel int
DECLARE @n int
SET @TargetDate = '2004-05-24'
SET @TLevel = 1


SET @SQLCmd = 'SELECT @n = count(*) FROM EventLog WHERE ((CONVERT(varchar(10), [Date], 101) = ''' +
CONVERT(varchar(10), @TargetDate, 101) + ''') AND (MsgLevel = ' +
CONVERT(varchar(3), @TLevel) + '))'
exec (@SQLCmd)
if @n > 0
print 'yep'
else print 'nope'

and, it's TRYING to work...but apparently the local variable @n is not recognized in the execution of the dynamic statement, as this is the output:
Server: Msg 137, Level 15, State 1, Line 1
Must declare the variable '@n'.
nope

Thoughts?

View 8 Replies View Related

Problem When Selecting Dynamic Connection Setting

Aug 8, 2006

Hello All,

I have a SSIS package, desgined in such a way that, there is a table called connection which hold the connection name i.e similar to my DSN connection name & a ID for each DSN there is a unique ID. Now i want if there is a 10 record in the table & i have only 5 DSN connection then i'll work for 5 & for other 5 it 'll skip the process. my task is running success fully for 1 connection. i have used foeach loop container & 3 varibable for that 2 for holding the table value & 1 for refereing the recordset

thanks



View 4 Replies View Related

Selecting One Of 3 Columns...

Dec 29, 2004

Hi,

I have a table that has 3 different types of dates (date1, date2, date3), and they represent the edit times of the 3 different sections on the website.
How do I select only one of those three that's the most recent? (It would represent the most recent edit on the website overall).
It would be an easy task if it was only one column - I would simply select the MAX, but I have to be selective between 3 different columns and pick the one I "like".

Thanks,

NB

View 8 Replies View Related

(Urgent) Help Need With In Selecting Too Many Columns.

Oct 29, 2007

Hi,
   I have a dbf file and that file has around 154 columns and in that i want to pull just 88 columns to my sql server database... I am using a OLedb connection and a data reader to read the data from the DBF file and then using a sqlbulcopy to insert the data into SQL server 2005 database. I have created a destination table for the 88 columns. This is my select statement for the dbf file. I have also used a Rownumber which is Int identity so i am using a 0 in the first column.
Dim command As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand("Select 0,* from FUND.DBF", connection)
 Now my question is Since i want to pull 88 columns instead of 154 column, I was thinking to give a select statement like
("Select, 0,Column1,.....Column88 From Fund.DBF", connection)
 SO instead of doing this is there is a way that i can specify in the sql statement that will tell it not to pull the rows after the 88th column.
 
Any help will be  appreciated.
Regards,
Karen
 

View 4 Replies View Related

Selecting Columns From 3 Inner Joins

Nov 15, 2012

I have 3 tables. They are inner joined. When I choose to select from all three tables I get a cartesian product.I've used distinct and I've tried cross apply with top 1. Top 1 brings back the right amount of records but it repeats the fields used in that select top N.

Basic question. Can you select from 3 different tables and avoid a cartesian result? I can have all three tables joined and with distinct I can get records from two of the tables without a cartesian. It is when I choose to select from a third is where the cartesian appears.If this is possible, what other tsql commands/constructs should I be experimenting with? URL....

View 9 Replies View Related

Selecting Multiple Columns Into One

Mar 18, 2008

I have a product table that has a productID column and a productName column. Then I have a productCategory table that associates productIDs with categoryIDs. And lastly I have a category table containing a categoryID and categoryName. I want to write a query that will return a table with three columns...productID, productName, and and calculated column containing the categories the product belongs to separated by a comma. A sample output would be...

ProductID____ProductName____Categories
1____________Green Flats____Footwear, Accessories, Women's Apparel
2____________Purple Belt____Accessories, Women's Apparel
3____________Pink Tunic_____Women's Apparel

If any of this isn't clear please feel free to write with questions.
So far I have this query -
SELECT Products.ProductID, ProductName, CategoryName FROM Products, ProductCategory, Categories WHERE Product.ProductID = ProductCategory.ProductID AND Categories.CategoryID = ProductCategory.CategoryID

This returns....
ProductID_____ProductName____CategoryName
1_____________Green Flats____Shoes
1_____________Green Flats____Accessories
1_____________Green Flats____Women's Apparel
2_____________Purple Belt____Accessories
2_____________Purple Belt____Women's Apparel
etc....

Any suggestions on how to remedy this???

View 5 Replies View Related

Error Selecting Null Columns

Jun 22, 2007

I want to run a query that selects rows from the table where a datetime column has null values;
select * from Orders where IsNull(dClosedDate,'Null') = 'Null'
However i get this error:
Conversion failed when converting datetime from character string.
Any help appreciated 
 

View 2 Replies View Related

Selecting Exactly 1 Row But More Columns From A Related Table..

Jan 4, 2008

I have table 1 from which I select some values belonging to users.In table 2 I store tips a user might give: tipid, tiptitle, tiptext,tipcreatedateA user may give more than one tip.But now I want a query that selects the info of a SINGLE user and the LATEST tip he created, so resultset might look like:username lastname sex tiptitle tiptext tipcreatedateSo even though a user might have given more tips, only the latest will be retreived...and thus 1 row for a particular user is returned...How would I construct such a query? The problem is that I want to get exactly 1 row but more than 1 column from the table 2, so I think I cannot use the SQL Server "TOP" command...

View 6 Replies View Related

Selecting Columns By Colmn Numbers

Nov 13, 2003

Is there a method to construct select statement on a table without using column names, based on column numbers.

I want to create a function which returns the contents columns 1 and 2, given just the name of the table.

An Execute statement, after retrieving the column names with Column_Name is not useful as they are not permitted in functions.

View 2 Replies View Related

Selecting Distinct On 3 Columns In Ms Sql Server

Feb 26, 2006

Hi, I think you can do this in oracle but I'm trying to figure a way to do it in ms sql.. I need to select a distinct combination of columns, like so...

select distinct(ItemName,ItemData,FID) from tblSIFups

Does anyone know how to achieve that? I have multiple data where I shouldn't and I don't have any control over the application so I need to clean it this way.

thanks, nicki

View 1 Replies View Related

Selecting One Greatest Number From Two Columns?

Jul 20, 2005

I have table1 and table2.In table1 I have a column of numbers, numbers1.In table2 I have a column of numbers, numbers2.I'd like to select the highest number represented in either column.Example:table1:column1--------------345565643656555676table2:column2--------------3456564556456456456456The number I would want would be 56456 since it's the largest numberout of all combined.How can I get that number with one select statement?--[ Sugapablo ][ http://www.sugapablo.com <--music ][ http://www.sugapablo.net <--personal ][ Join Bytes! <--jabber IM ]

View 1 Replies View Related

Selecting The Latest Date From Different Columns

Jul 20, 2005

I have 6 columns, all with dates within them, i.e.Proposed Start Date 1Proposed Start Date 2Proposed Start Date 3Proposed Finish Date 1Proposed Finish Date 2Proposed Finish Date 3What I need to do is narrow this down into two fields:Start DateFinish DateSo I need to find the newest value from the columns. i.e.If PS1 filled PS2 and PS3 empty, then Start Date = PS1If PS3 empty and PS2 filled, then Start Date = PS2If PS3 filled then PS3and similarly for Proposed Finish Dates.Anyone knew how I can do this.(Maybe the following will help for the programmers out there:If PS3 <> nullThen StartDate = PS3Else if PS2 <> nullThen StartDate = PS2ElseStartDate = PS1End IFJagdip

View 5 Replies View Related

Selecting The Rows Based Off Of Unique Columns

Mar 18, 2007

Hi there, im still learning SQL so thanks in advance.I have a table with columns of customer's information, [customerID], [customerFirst], [customerLast], , [program] ... other columns ...  There will be entries where there can be duplicate customerFirst and customerLast names.  I would like to just return a single entry of the duplicate names and all associated row information.  IE: [customerID], [customerFirst], [customerLast],            [ email],             [program]         01               Bill                 Smith             bill.smith@hotmail.com    ymca        02               Bill                 Smith             bill.smith@hotmail.com    Sports        03               jon                   doe                 jon.doe@hotmail.com    AAA        04               jon                   doe                 jon.doe@hotmail.com    Ebay          05               Paul                 Sprite             paul.sprite@hotmail.com    Rec Desired Returned result:        01               Bill                 Smith             bill.smith@hotmail.com    ymca        03               jon                   doe                 jon.doe@hotmail.com    AAA
         05               Paul                 Sprite             paul.sprite@hotmail.com    Rec So in my code i have this:dAdapter = new SqlDataAdapter("SELECT * FROM [Poc_" + suffix + "] WHERE (SELECT DISTINCT [CustomerLastName], [CustomerFirstName], [CustomerEmail] FROM [Poc_" + suffix + "])", cnStr);         dAdapter.Fill(pocDS, "Data Set");        However this is throwing up an error when i build the app:  An expression of non-boolean type specified in a context where a condition is expected, near ')'.



Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException:
An expression of non-boolean type specified in a context where a
condition is expected, near ')'.

Source Error:




Line 52: //dAdapter = new SqlDataAdapter("SELECT DISTINCT * FROM [Poc_" + suffix + "] ORDER BY [CustomerLastName]", cnStr); Line 53: dAdapter = new SqlDataAdapter("SELECT * FROM [Poc_" + suffix + "] WHERE (SELECT DISTINCT [CustomerLastName], [CustomerFirstName], [CustomerEmail] FROM [Poc_" + suffix + "])", cnStr); Line 54: dAdapter.Fill(pocDS, "Data Set");Line 55: Line 56: //Dataset for name comparison  1: Can someone explain to me why this error is happening?2: Can soemone confirm that my intentions are correct with my code?3: If I'm completely off, can someone steer me in the right direction?Thanks alot!-Terry  

View 12 Replies View Related

Selecting Columns From Different Tables Into A Single Table

Jan 5, 2008

I want to select columns from different tables into a single table...Not sure if a temp table is suited for this and if so how I should implement it (NOTE: this query will be executed many times by different users at the same time, so I'd rather avoid temp tables!)I have:TABLE1idfirstnamedescriptioncreatedateTABLE2idcarnamespecificationsimportdateNow, I want a resultset that has the columns (columns from other tables from which the values should be retreived are behind the desired columns):id  (TABLE1.id, TABLE2.id)title (TABLE1.firstname , TABLE2.carname)description (TABLE1.description , TABLE2.sepcifications)date (TABLE1.createdate , TABLE2.importdate)Thanks!

View 1 Replies View Related

QUERY HELP: Selecting Distinct For Two Columns Group By One

Jul 23, 2005

Greetings.I'm having a little trouble with a query. The idea is simple I need todisplay a list of recently unique visited URLs and the last time Ivisited.I have 2 table one stores the user and time/date and another has theURL.So all I need is the URL (no duplicates) and the last visit.Below is the SQL to create the tables and data to help with the query.Thank you for your help.CREATE TABLE [stat_hits] ([hit_id] [int] (1, 1) NOT NULL ,[hit_date] [datetime] NOT NULL CONSTRAINT [DF_stat_hits_hit_date]DEFAULT (getdate()),[user_id] [varchar] (12) NOT NULL ,[hit_ip] [varchar] (15) NOT NULL ,[shp_id] [int] NOT NULL ,CONSTRAINT [PK_stat_hits] PRIMARY KEY CLUSTERED([hit_id]) ON [PRIMARY]) ON [PRIMARY]GOCREATE TABLE [stat_hit_pages] ([shp_id] [int] (1, 1) NOT NULL ,[shp_url] [varchar] (1000) NULL ,[shp_count] [int] NULL ,CONSTRAINT [PK_stat_hit_pages] PRIMARY KEY CLUSTERED([shp_id]) ON [PRIMARY]) ON [PRIMARY]GOINSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37878,'2005-06-01 16:07:35','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37877,'2005-06-01 16:07:13','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37876,'2005-06-01 15:41:17','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37875,'2005-06-01 15:41:03','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37874,'2005-06-01 15:20:31','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37873,'2005-06-01 15:20:28','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37872,'2005-06-01 14:45:46','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37871,'2005-06-01 14:35:51','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37870,'2005-06-01 14:30:25','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37869,'2005-06-01 14:28:28','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37868,'2005-06-01 14:28:23','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37867,'2005-06-01 14:28:17','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37866,'2005-06-01 14:28:15','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37861,'2005-06-01 14:27:09','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37860,'2005-06-01 14:27:05','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37859,'2005-06-01 14:26:59','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37858,'2005-06-01 14:26:58','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37853,'2005-06-01 14:25:59','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37852,'2005-06-01 14:23:51','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37851,'2005-06-01 13:58:49','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37850,'2005-06-01 13:44:06','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37849,'2005-06-01 13:44:04','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37848,'2005-06-01 13:44:04','ADMIN','0.0.0.0',7340)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37847,'2005-06-01 13:43:58','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37846,'2005-06-01 13:43:53','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37845,'2005-06-01 13:26:29','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37844,'2005-06-01 13:22:34','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37843,'2005-06-01 13:22:29','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37842,'2005-06-01 13:21:15','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37841,'2005-06-01 13:19:17','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37840,'2005-06-01 13:17:20','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37839,'2005-06-01 13:17:20','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37838,'2005-06-01 11:55:15','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37837,'2005-06-01 11:55:09','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37836,'2005-06-01 11:53:08','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37835,'2005-06-01 11:53:01','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37834,'2005-06-01 11:34:34','ADMIN','0.0.0.0',7337)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37833,'2005-06-01 11:34:24','ADMIN','0.0.0.0',7336)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37832,'2005-06-01 11:02:59','ADMIN','0.0.0.0',7335)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37831,'2005-06-01 11:02:53','ADMIN','0.0.0.0',7334)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37830,'2005-06-01 11:02:46','ADMIN','0.0.0.0',7324)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37829,'2005-06-01 11:02:40','ADMIN','0.0.0.0',7333)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37828,'2005-06-01 11:02:31','ADMIN','0.0.0.0',7332)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37827,'2005-06-01 11:02:25','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37826,'2005-06-01 11:02:21','ADMIN','0.0.0.0',7331)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37825,'2005-06-01 11:02:12','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37824,'2005-06-01 11:01:23','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37823,'2005-06-01 11:01:21','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37822,'2005-06-01 11:01:20','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37821,'2005-06-01 10:58:23','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37820,'2005-06-01 10:58:10','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37819,'2005-06-01 10:58:09','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37818,'2005-06-01 10:55:27','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37817,'2005-06-01 10:55:23','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37816,'2005-06-01 10:55:17','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37815,'2005-06-01 10:55:16','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37810,'2005-06-01 10:54:20','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37809,'2005-06-01 10:54:12','ADMIN','0.0.0.0',7329)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37808,'2005-06-01 10:51:30','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37807,'2005-06-01 10:51:29','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37806,'2005-06-01 10:51:10','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37805,'2005-06-01 10:51:09','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37804,'2005-06-01 10:35:46','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37803,'2005-06-01 10:35:41','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37802,'2005-06-01 10:35:29','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37801,'2005-06-01 10:35:21','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37800,'2005-06-01 10:35:20','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37799,'2005-06-01 10:33:58','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37798,'2005-06-01 10:33:50','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37797,'2005-06-01 10:33:50','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37796,'2005-06-01 10:33:09','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37795,'2005-06-01 10:33:05','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37794,'2005-06-01 10:32:45','ADMIN','0.0.0.0',7324)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37793,'2005-06-01 10:32:18','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37792,'2005-06-01 10:31:47','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37791,'2005-06-01 10:31:31','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37790,'2005-06-01 10:31:31','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37789,'2005-06-01 10:30:04','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37788,'2005-05-31 20:49:56','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37787,'2005-05-31 20:49:54','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37786,'2005-05-31 20:49:54','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37785,'2005-05-31 20:49:02','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37784,'2005-05-31 20:48:54','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37783,'2005-05-31 20:48:53','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37782,'2005-05-31 20:48:52','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37781,'2005-05-31 20:48:41','ADMIN','0.0.0.0',5941)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37780,'2005-05-31 20:48:37','ADMIN','0.0.0.0',215)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37779,'2005-05-31 20:48:30','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37775,'2005-05-31 20:46:44','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37774,'2005-05-31 20:46:40','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37773,'2005-05-31 20:46:39','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37772,'2005-05-31 20:46:12','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37771,'2005-05-31 20:46:09','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37770,'2005-05-31 20:46:08','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37769,'2005-05-31 20:45:55','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37768,'2005-05-31 20:45:52','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37767,'2005-05-31 20:45:51','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37766,'2005-05-31 20:45:33','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37765,'2005-05-31 20:45:29','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37764,'2005-05-31 20:45:29','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37763,'2005-05-31 20:45:28','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37762,'2005-05-31 20:44:52','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37761,'2005-05-31 20:44:48','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37760,'2005-05-31 20:44:47','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37759,'2005-05-31 20:44:23','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37758,'2005-05-31 20:44:18','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37757,'2005-05-31 20:44:18','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37756,'2005-05-31 20:43:50','ADMIN','0.0.0.0',6258)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37755,'2005-05-31 20:43:41','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37754,'2005-05-31 20:43:37','ADMIN','0.0.0.0',7318)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37753,'2005-05-31 20:43:36','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37752,'2005-05-31 20:43:31','ADMIN','0.0.0.0',7317)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37751,'2005-05-31 20:43:16','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37750,'2005-05-31 20:43:10','ADMIN','0.0.0.0',6684)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37749,'2005-05-31 20:43:10','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37748,'2005-05-31 20:40:04','ADMIN','0.0.0.0',7318)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37747,'2005-05-31 20:40:00','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37746,'2005-05-31 20:39:52','ADMIN','0.0.0.0',7317)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37745,'2005-05-31 20:39:24','ADMIN','0.0.0.0',7316)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37744,'2005-05-31 20:39:23','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37743,'2005-05-31 20:35:56','ADMIN','0.0.0.0',7315)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37742,'2005-05-31 20:35:43','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37741,'2005-05-31 20:34:17','ADMIN','0.0.0.0',7314)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37740,'2005-05-31 20:34:17','ADMIN','0.0.0.0',1449)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37739,'2005-05-31 20:34:01','ADMIN','0.0.0.0',7313)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37738,'2005-05-31 20:33:54','ADMIN','0.0.0.0',7312)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37737,'2005-05-31 20:12:57','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37736,'2005-05-31 20:09:40','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37735,'2005-05-31 20:09:33','ADMIN','0.0.0.0',6258)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37734,'2005-05-31 20:09:03','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37733,'2005-05-31 20:08:49','ADMIN','0.0.0.0',7289)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37732,'2005-05-31 20:08:44','ADMIN','0.0.0.0',6254)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37731,'2005-05-31 20:08:42','ADMIN','0.0.0.0',3443)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37730,'2005-05-31 20:08:40','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37729,'2005-05-31 20:08:32','ADMIN','0.0.0.0',5983)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37728,'2005-05-31 20:08:24','ADMIN','0.0.0.0',6960)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37727,'2005-05-31 20:08:22','ADMIN','0.0.0.0',5918)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37726,'2005-05-31 20:08:18','ADMIN','0.0.0.0',25)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37725,'2005-05-31 20:08:15','ADMIN','0.0.0.0',5740)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37724,'2005-05-31 20:08:11','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37723,'2005-05-31 20:08:09','ADMIN','0.0.0.0',3)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37720,'2005-05-31 20:08:03','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37617,'2005-05-31 18:51:08','ADMIN','0.0.0.0',7290)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37615,'2005-05-31 18:51:00','ADMIN','0.0.0.0',7289)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37598,'2005-05-31 18:48:08','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37597,'2005-05-31 18:48:04','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37596,'2005-05-31 18:48:03','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37595,'2005-05-31 18:47:21','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37594,'2005-05-31 18:47:12','ADMIN','0.0.0.0',6960)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37593,'2005-05-31 18:47:09','ADMIN','0.0.0.0',5918)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37592,'2005-05-31 18:47:02','ADMIN','0.0.0.0',5740)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37590,'2005-05-31 18:46:59','ADMIN','0.0.0.0',6587)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37583,'2005-05-31 18:46:40','ADMIN','0.0.0.0',9)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37582,'2005-05-31 18:46:31','ADMIN','0.0.0.0',1691)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37580,'2005-05-31 18:46:18','ADMIN','0.0.0.0',9)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37576,'2005-05-31 18:46:04','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37575,'2005-05-31 18:46:02','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37574,'2005-05-31 18:46:01','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37569,'2005-05-31 18:45:24','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37568,'2005-05-31 18:45:16','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37567,'2005-05-31 18:45:16','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37563,'2005-05-31 18:44:07','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37562,'2005-05-31 18:44:05','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37561,'2005-05-31 18:44:04','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37545,'2005-05-31 18:40:30','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37544,'2005-05-31 18:40:30','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37543,'2005-05-31 18:40:12','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37536,'2005-05-31 18:34:19','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37535,'2005-05-31 18:34:15','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37534,'2005-05-31 18:34:14','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37532,'2005-05-31 18:27:02','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37531,'2005-05-31 18:27:00','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37530,'2005-05-31 18:27:00','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37518,'2005-05-31 18:00:34','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37517,'2005-05-31 18:00:31','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37516,'2005-05-31 18:00:31','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37515,'2005-05-31 17:59:41','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37514,'2005-05-31 17:59:37','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37513,'2005-05-31 17:59:37','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37512,'2005-05-31 17:59:01','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37511,'2005-05-31 17:58:58','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37510,'2005-05-31 17:58:57','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37509,'2005-05-31 17:56:16','ADMIN','0.0.0.0',6610)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37508,'2005-05-31 17:56:07','ADMIN','0.0.0.0',6989)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37507,'2005-05-31 17:56:01','ADMIN','0.0.0.0',6610)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37506,'2005-05-31 17:55:56','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37505,'2005-05-31 17:55:52','ADMIN','0.0.0.0',7199)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37504,'2005-05-31 17:55:43','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37503,'2005-05-31 17:55:41','ADMIN','0.0.0.0',7199)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37502,'2005-05-31 17:53:57','ADMIN','0.0.0.0',7269)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37501,'2005-05-31 17:53:44','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37500,'2005-05-31 17:53:40','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37499,'2005-05-31 17:53:40','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37498,'2005-05-31 17:52:18','ADMIN','0.0.0.0',7269)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37497,'2005-05-31 17:52:06','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37496,'2005-05-31 17:51:28','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37495,'2005-05-31 17:51:22','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37494,'2005-05-31 17:51:22','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37493,'2005-05-31 17:51:01','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37492,'2005-05-31 17:50:57','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(3,'/scripts/iMenu.asp?_Ref=450493&_XID=40000000&ParentID=',2245)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(4,'/scripts/objects/MyZBF.asp?_XID=19999900&_Ref=450493&_Ref2=',2917)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7329,'/scripts/objects/list.asp?_XID=70000005&_Ref=1398186089&_reset=true&_table=2002000&|MenuID=40000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7330,'/scripts/objects/edit.asp?_XID=70000005&_Ref=1398186089&_table=2002000&_item=ADAMDOUG',5)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7331,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=225000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7332,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=215000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7333,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_table=1002009&',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7334,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_table=1001000&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7335,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1001000&_item=1002009&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7336,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1001054&_item=1000006&_parenturl=3',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7337,'/scripts/objects/edit.asp?_xid=70000028&_ref=1398186089&_table=1001054&&_parenturl=3',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7338,'/scripts/objects/navigator.asp?_xid=70000030&_ref=1398186089',12)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7339,'/scripts/objects/navigator.asp?_xid=70000028&_ref=1398186089',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7340,'/scripts/iKnow.asp?_ref=1398186089&_deep=http%3A//ZBFw2kdev01/scripts/objects/edit.asp%3F_XID%3D70000005%26_Ref%3D1398186089%26_ table%3D2002000%26_item%3DADAMDOUG',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(9,'/scripts/objects/list.asp?_XID=70000052&_Ref=450493&_reset=true&_table=215000001&|MenuID=40000000',1532)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(25,'/scripts/objects/list.asp?_XID=70000028&_Ref=450493&_reset=true&_table=1002009&|MenuID=40000000',144)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(31,'/scripts/objects/save.asp?',3986)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(215,'/scripts/objects/list.asp?_XID=70000030&_Ref=450493&_reset=true&_table=3001062&|MenuID=40000000',138)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(1449,'/scripts/objects/mappings.asp?',17)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(1691,'/scripts/objects/edit.asp?_XID=70000052&_Ref=450493&_table=215000001&_item=11',26)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(3443,'/scripts/objects/list.asp?_XID=70000028&_Ref=450493&_table=1001000&_parenturl=2',16)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5740,'/scripts/objects/consolemaster.asp?_XID=80000003&_Ref=450493&_reset=true&showall=false&page_id=215000002&|MenuID=40000000',177)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5918,'/scripts/objects/consolemaster.asp?_XID=80000003&_Ref=450493&showall=false&mode=listitself&item=215000006&page_id=215000002',15)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5941,'/scripts/objects/edit.asp?_XID=70000030&_Ref=450493&_table=3001062&_item=12',9)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5942,'/scripts/objects/edit.asp?_XID=70000030&_Ref=450493&_table=3001062&_item=12&_formtab=&process=&step=&elem=',62)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5983,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1002009&_item=225000000',15)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6103,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001002&_parenturl=3&_item=215000018&_formtab=&process=&step=&elem=',21)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6254,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_item=225000001&_parenturl=2',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6258,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_item=225000001&_parenturl=2&',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6587,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&_reset=true&showall=false&page_id=215000003&|MenuID=40000000',81)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6610,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000003',88)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6681,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001054&_item=225000175&_parenturl=4',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6684,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001054&_parenturl=4&_item=225000175&_formtab=&process=&step=&elem=',7)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6960,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=215000001&_item=68',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6979,'/scripts/objects/edit.asp?_XID=70000052&_Ref=450493&_table=215000001&_item=161&process=215000001&step=215000003&elem=215000018',25)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6989,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&mode=drill&item=215000120&drill_id=215000005&page_id=215000003&group=1&desc=BTFG',54)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7199,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000006',24)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7269,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000010',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7271,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&mode=listitself&item=215000200&page_id=215000006&group=1&desc=Operations%20Executive',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7282,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=215000001&_item=68&process=215000001&step=215000003&elem=215000018',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7289,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=75&_parenturl=1',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7290,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7311,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75',11)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7312,'/scripts/objects/showpopup.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75&destable=225000001&_mode=mappings&_seed=72528.66',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7313,'/scripts/objects/mappings.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75&destable=225000001&_mode=mappings&_seed=72528.66&_popup=true',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7314,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=90&process=&step=&elem=',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7315,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=90',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7316,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=90&_formtab=0&process=&step=&elem=',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7317,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7318,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86&_formtab=&process=&step=&elem=',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7319,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_parenturl=2&_item=225000001&_formtab=&process=&step=&elem=',5)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7320,'/scripts/iknow.asp?_Ref=1398186089',6)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7321,'/scripts/iMenu.asp?_Ref=1398186089&_XID=40000000&ParentID=',10)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7322,'/scripts/objects/MyZBF.asp?_XID=19999900&_Ref=1398186089&_Ref2=',9)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7323,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_reset=true&_table=1002009&|MenuID=40000000',8)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7324,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=1000001',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7325,'/scripts/objects/list.asp?_XID=70000030&_Ref=1398186089&_reset=true&_table=3001062&|MenuID=40000000',6)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7326,'/scripts/objects/edit.asp?_XID=70000030&_Ref=1398186089&_table=3001062&_item=12',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7327,'/scripts/objects/save.asp?',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7328,'/scripts/objects/edit.asp?_XID=70000030&_Ref=1398186089&_table=3001062&_item=12&_formtab=&process=&step=&elem=',4)

View 2 Replies View Related

Selecting Only The List Of Columns From A Table Based On Input

Apr 17, 2008

Hi,
i have a table like below

table:-
id col2 col3 col4 col5 col6
1 2 3 4 5 6
2 5 8 4 7 6
3 4 8 2 6 9
4 2 5 8 6 3
5 6 9 5 5 9

i want to write a stored procedure where i pass column names a parameters and i want to get result based on that
For ex:-
if i pass the parameters as
col3 and col5 where id =1 then i should the result as

id col3 col4 col5
1 3 4 5

and if i pass input as col2and col6 where id =3, the result should be
id col2 col3 col4 col5 col6
3 4 8 2 6 9

can anyone help on this??

View 3 Replies View Related

Sorting Problem? Most Recent Entry When Selecting Multiple Columns

Oct 19, 2007

I'm trying to determine the oldest timestamp that meets given criteria which includes a specific action_type code. That code can legitimately be performed more than once on an item (all actions are recorded in an actions table, so the full history is available).

actions table (columns: action_id, request_id, action_type, action_time, action_reason)

I'm having trouble getting the most recent timestamp for the given action_type I'm looking for, when that action_type has been performed more than once.

My intent with the query below is to get the most recent action_time and it's request_id that meets the criteria


SELECT TOP 1 a.action_time, r.request_id FROM requests r JOIN incident i ON r.request_id = i.request_id LEFT JOIN actions a ON r.request_id = a.request_id WHERE i.refund_type = 1 AND (r.status_code = 3 OR r.status_code = 14) AND a.action_type = 3 ORDER BY a.action_time


So for example, if the item with request_id 1334 has had action_type 3 performed on it twice, once at 2007-10-15 13:30:00 and then again at 2007-10-17 14:40:00, it's picking up the former, when I want the later. That it had action_type 3 performed on it twice is legitimate. (larger context an item was approved by a manager, then rejected by a processor, and then approved by a manager again after resubmission)

Hopefully this has made sense so far.

So, how do I make sure I'm getting the most recent action time, when I don't know if the item in particular will have more than one of this action type performed on it?

View 5 Replies View Related

Microsoft SQL Server 2005. Selecting Multple Columns From Multiple Tables

Mar 23, 2008

Im just curious how i would take multiple columns from multiple tables.... would it be something like this ???
table: Products COLUMNS ProductName, ProductID
table: Categorys COLUMNS CategoryName, CategoryID,ProductID
SELECT Products.ProductName, Categorys.CategoryName,Products.ProductID,Categorys.CategoryID,Categorys.ProductID
FROM Categorys, Tables
WHERE Products.ProductID = Categorys.ProductID
 

View 1 Replies View Related

SQL Server 2012 :: Dynamically Create A Script Only Selecting Columns Where There Is Data?

Dec 2, 2013

I have created some dynamic sql to check a temporary table that is created on the fly for any columns that do contain data. If they do the column name is added to a dynamic sql, if not they are excluded. This looks like:

If (select sum(Case when [Sat] is null then 0 else 1 end) from #TABLE) >= 1 begin set @OIL_BULK = @OIL_BULK + '[Sat]' +',' END However, I am currently running this on over 230 columns and large tables 1.3 mil rows and it is quite slow. How I can dynamically create a sql script that only selects the columns in the table where there is data in a speedier manner. Unfortunately it has to be on the fly because the temporary table is created on the fly.

View 1 Replies View Related

Dynamic Columns For Dynamic SQL

Mar 9, 2007

I have created a dynamic SQL program that returns a range of columns (1 -12) based on the date range the user may select. Each dynamic column is month based, however, the date range may overlap from one year to another. Thus, the beginning month for one selection may be October 2005, while another may have the beginning month of January 2007.

Basically, the dynamic SQL is a derived Pivot table. The problem that I need to resolve is how do I now use this dynamic result set in a Report. Please keep in mind that the name of the columns change based on the date range select.

I have come to understand that a dynamic anything is a moving target!



Please advise.

View 3 Replies View Related

Dynamic Columns

Mar 18, 2004

Hi all, a quicky.

What is wrong with:

CREATE PROCEDURE dbo.QuotePrice
@DateFrom datetime,
@DateTo datetime
AS
declare @days as int
declare @price as smallint
declare @daycolumn as nvarchar(6)

set @price = 0

set @days = DATEDIFF(day, @DateFrom, @DateTo)

set @daycolumn = 'Day_' + CAST(@days AS nvarchar(2))

set @price = (SELECT @daycolumn FROM pasPriceTable)

return @price
GO


Problem is:
Syntax error converting the nvarchar value 'Day_10' to a column of data type smallint

How do I set a variable to a result from a query?
Thanks,
/ j0rge

View 9 Replies View Related

Dynamic Columns

Sep 6, 2007

Hi all again,I need an output like :|----|----|----|---|------||row1|row2|row3|...|row(n)||----|----|----|---|------|is possible to create output like that, without querying manuallycause too many dynamic columns in my application.sorry if my question a bit weird cause i'm a newbie in MSSQL.Cheers.

View 1 Replies View Related

Dynamic Columns

Sep 20, 2007

My report has a large number of rows in the details section, This wastes a lot of space. I'd like to spread these rows across multiple columns in the details section of my table.

What i'm currently getting...
---ROW1----------
---ROW2----------
---ROW3----------
---ROW4----------
---ROW5----------
---ROW6----------
---ROW7----------
---ROW*----------
---ROW9----------

What I'd like to see...

---ROW1---------- ---ROW2---------- ---ROW3----------
---ROW4---------- ---ROW5---------- ---ROW6----------
---ROW7---------- ---ROW8---------- ---ROW9----------

Is this possible, if so, how??

View 4 Replies View Related

Are Dynamic Columns Possible ?

Mar 19, 2007

Hi folks

I'm trying to roll out / createcolumns dynamically, based on a parameter selection, which in turn can calculate the number of columns to be inserted.

For example, if my parameter selects the first Option viz. Business Unit, I need to find out how many standard business units exist (un-specified and depending on the client) and have that many standard width columns generated and have each populated with a column header label + appropriate value.

the columns have to be dynamic and the same information is preferred if it is NOT presented in a drill down format (row-wise).



Thanks for any inputs coming in :)

Prashanth

View 1 Replies View Related

Dynamic Number Of Columns

Jun 2, 2005

when using sorred procedure to create a temporary table is it possable to base the number of columns in that table on another variable?

View 5 Replies View Related

Dynamic Columns Returned

Sep 6, 2006

I need to write a query that will return an unknown number of columns. Here's the problem:

Let's say you've got a database tracking applications to different university study abroad programs. There may be a dozen or more programs, and the application could be used at any number of different schools, each with different programs. So you have a programs table with ProgramName and ProgramID.

Each program could require a different set things submitted during the application process. So you have a Submissions table, with SubmissionItem and SubmissionID to list the names of each required submission, a Program_Submissions table, with ProgramID and SubmissionID to link Programs to required application items, a SubmittedItems table, that accepts documents uploaded by a user to fullfill the submission requirements, and of course a users table.

I'm not very concerned at the moment about the last two tables. What I need to do is create a report (query) where the first column is the program name, and the other columns are determined by the contents of the Submissions table- if Program_Submissions record exists linking a program to a submission, place a value of 'Y' in that cell, otherwise leave it blank. Any thoughts on how to accomplish this?

I need to do this in a single query that a I can dump into a report builder application to save as a template to give to several people that have been asking for it, and to complicate matters even more, the description above is a little simple, as there are couple different kinds of submissions, with a different table for each.

Any help appreciated. I give rep for good answers!

View 3 Replies View Related

Pivot On Dynamic Columns

May 11, 2006

I have a table with 40k terms and I need to map these to a set of objects where each object is represented as a column(tinyint). The object/column name is represented as a guid and columns are added/removed dynamically to support new objects for a set of terms.

I can get the rows needed:

guid1guid2guid3guid4guid5
================================
01100
01101

I think I need to then convert this set of rows to a table which I can join to the object runtime table to start these objects if the column has a count/sum greater than 0. This is the table I think I need in order to join on guids to the runtime table:

NAME Count
===========
guid10
guid22
guid32
guid40
guid51

I don't know how to construct this table for the former table. I think it may be a pivot table, but I don't know. I have the column names:

SELECT NAME
FROM SYSCOLUMNS
WHERE ID = OBJECT_ID(#Temp)
ORDER BY COLID

NAME is a sysname, which doesn't seem to cast into a guid, also a problem when joining the runtime table with this #Temp table.

I also don't want to use a cursor to construct a table.


Thanks for any help,
James

View 1 Replies View Related

Report With Dynamic Columns

Jun 10, 2008

Hi,
I'm trying to create a report with dynamic columns. I mean that the user is able to select if he wants to see a double drill report with client group and product group, or agents with clients, or everything else he needs. I tried to insert some variables in the query that extracts data from report, and using that variables like parameters, but Reporting Services always get the parameter default value and not the correct value i give him.
How can I solve my problem? There is another way to obtain dynamic reports?

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved