Find Jobs
Hire Freelancers

Write SQL Server Code for SQL Open query

$10-30 CAD

Completed
Posted about 8 years ago

$10-30 CAD

Paid on delivery
I want to run an openquery statement and inside it i want 130 column names generated starting from V001 to V139. These columns already exist in table, i only want number to be generated from 1 to 139. And i want to pivot them together in a single row by time. Deliverable should be Time,[[login to view URL]],[[login to view URL]], ..[[login to view URL]],...,[[login to view URL]] I have following code which only generate 1 to 9 columns and not in one row. I want this in 1 day... DECLARE @TSQL varchar(8000), @VAR char(5),@wwVersion char(6) ,@Counter int,@Counterv1 int SELECT @VAR = 'delta' SELECT @wwVersion = 'Latest' SELECT @Counter = 0 SELECT @Counterv1 = 10 while @counter < 9 Begin set @counter = @counter + 1 -- SELECT @Counterstr = 'V00' + rtrim(cast(@counter as char)) print @counter SELECT @TSQL = 'SELECT * FROM OPENQUERY(INSQL,''SELECT IF ' + rtrim(cast(@counter as char)) + ' <= 10 THEN [CPW_V00' + rtrim(cast(@counter as char)) +'.WTOperationState] ELSE [CPW_V0' + rtrim(cast(@counter as char)) +'.WTOperationState] FROM WideHistory WHERE wwRetrievalMode = ''''' + @VAR + ''''' AND wwVersion = ''''' + @wwVersion + ''''' '' ) ' EXEC (@TSQL) End
Project ID: 9882185

About the project

2 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi, I am certified MSSQL Server developer (MCSE: Data Platform). Would be glad to help you with this task. Regards, Yuri.
$25 CAD in 1 day
0.0 (0 reviews)
0.0
0.0
2 freelancers are bidding on average $30 CAD for this job
User Avatar
Will come up with a good script based on the requirements and I would just need the sample data for the reference,
$35 CAD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CANADA
calgary, Canada
5.0
1
Payment method verified
Member since Mar 8, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.