SQL Server 2008 :: Updating Server Table From Excel Cells?
Jul 3, 2015
I have an sql server table which serves as a criteria table for my sql server query.
i wish to update the sql server table from the excel worksheet. The intention is to allow the end user to change the values in a specific column in the sql server table via excel.
The table in question has the following fields
SELECT
[Cluster]
,[Max_Break_btw]
,[RefD_Max_Break]
,[DischD_Max_Break]
,[MaxReviewPeriods]
FROM [databseName].[dbo].[SpellClusterAssum]
I will like to change / update the values in the "[Max_Break_btw]" column.
View 0 Replies
ADVERTISEMENT
Jun 18, 2008
I have two questions. I am somewhat of a novice at this but would really appreciate some help.
Table = svc
There are multiple columns but I just need adjustments in the first 2.
Current Table:
code name svctype
CTS0003CT Abd Ltd 51608
CTS0005CT Abd W Cont 51608
CTS0011CT Abd WWO Cont 51608
CTS0013CT Abd WO Cont 51608
CTS0023CT Abd-Ltd Pel W Cont51608
CTS0025CT Abd-Ltd Pel WO Cont51608
What I want it update it to:
code name svctype
RCT0003AR CT Abd Ltd 19254
RCT0005AR CT Abd W Cont 19254
RCT0013AR CT Abd WO Cont 19254
RCT0011AR CT Abd WWO Cont 19254
RCT0023AR CT Abd-Ltd Pel W Cont19254
RCT0025AR CT Abd-Ltd Pel WO Cont19254
QUESTION #1:
So I am trying to figure out if I could write a statement that basically updates the CODE column’s first three letters in each cell from CTS to RCT and retains the numbers afterwards.
QUESTION #2
The NAME column in Table 1 would also need a little adjustment.
I need to add AR in front (almost like a prefix) of all of the descriptions (so that it looks like Table #2). How do I insert something into the description?
I greatly appreciate anyone's help in this. It would save me counltess hours.
-T.C.
View 2 Replies
View Related
Feb 27, 2008
I have around 600 worksheets that i need to import into sql server that are in a somewhat non-table like format. Data defractor seems to be able to do what i need, but i also need to check into doing it manually. I've seen the code to import cells and ranges into sql server, but can't seem to remember what it is anymore. I've also searched through the forums and can't seem to find any examples either. Could anyone post an example or a link with some examples or explaination code. Thanks in advance.
View 4 Replies
View Related
Aug 16, 2007
Hi,
I know that we can have User Defined Functions (UDFs) for columns but is it possible to have UDFs for each cell (like we can define functions for each cell in excel). Heres the situation:
I have a database table that will have multiple fields. Some of the columns will be functions of other columns. One of the columns has variable functions.
Heres an example:
TABLE(A, B, C, D)
Total Records = 9;
A
B
C
D
A1
B1
C1 = A1+ B1
D1 = A1
A2
B2
C2 = A2+ B2
D2 = A2
A3
B3
C3 = A3+ B3
D3 = A3
A4
B4
C4 = A4+ B4
D4 = A4
A5
B5
C5 = A5+ B5
D5 = A5 + B5
A6
B6
C6 = A6+ B6
D6 = A6 + B6
A7
B7
C7 = A7+ B7
D7 = A7 + B7
A8
B8
C8 = A8+ B8
D8 = A8 + B8
A9
B9
C9 = A9+ B9
D9 = A9 + B9
If you notice, for Column D, some of the cells have a different formula than others. Is this doable?
Thanks...
View 5 Replies
View Related
Feb 1, 2007
I have a report with a column which contains either a string such as "N/A" or a number such as 12. A user exports the report to Excel. In Excel the numbers are formatted as text.
I already tried to set the value as CDbl which returns error for the cells containing a string.
The requirement is to export the column to Excel with the numbers formatted as numbers and the strings such as "N/A' in the same column as string.
Any suggestions?
View 1 Replies
View Related
Jun 15, 2015
I am getting an error (number -2147217887, error message "ODBC--call failed.") when I try to execute an rst.Update. I have an MS Access 2013 application using an ODBC connection to SQL Server 2008 r2. I am using a query to update a table. It is a simple Select query with no joins. I have checked to make sure the table can be updated.
I was not sure if there were any special permissions that I need to set to allow a linked table to be updated in MS Access this way?
View 4 Replies
View Related
Apr 28, 2015
I have the following in my table. As you can see the Geo field is null (which is of type Geography), what I'm trying to do is populate that with an update statement by comparing the latitude and longitude for each row so I can then work out the distance, I've been following this tutorial to workout the distance which is giving me the desired results
[URL] ....
The issue I have is passing in the points i.e latitude and longitude and then updating the Geo field for the row, I currently have 11938 rows in my DB so I need to run this against all of them. I thought I had it I was thinking of update then select from the source but then I realized I need to pass the lat and long in for the points and that's where I got confused
View 4 Replies
View Related
Jan 30, 2015
I have a request to export some table data to excel and the "notes" column (varchar 255) contains multiple lines separated by CR/LF. when I export to excel, the first record with CR/LF messes up the column alignment in excel, throwing off the format from that point on. how can i export to excel so that it preserves these CR/LF. or if not, how can I remove these characters so that excel can handle it?
See attached example
View 3 Replies
View Related
Jun 9, 2015
Using below statement to export a table from sql server 2008 to EXCEL 2010
Insert into Openrowset
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:ExportXLS.xlsx;' ,
'SELECT * FROM [employees$]')
SELECT name,id,group,agency FROM dbo.employees
getting below ERROR
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
below changes also done.
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO
View 2 Replies
View Related
Sep 8, 2015
I have a requirement of generating an "Sales Report" excel file and mailing that file to a particular email id. I have generated the excel file through bcp command and mail is working fine.
However formatting of excel file is required by end user for eg. Cells to be merged and borders to be given for cells for which i think bcp command will not work.
View 3 Replies
View Related
Sep 15, 2015
I was able to create a view and convert it to excel. Now I want to it to schedule it for everyday and then email the excel file as an attachment to couple of people.
Would SSRS be an option? where I can create a report of the view and schedule it?
Does any know the process I need to follow?
Do I have to uses SSIS ? and then set it up as SQl server job?
View 9 Replies
View Related
Dec 6, 2012
I am trying to update a SQL table using an excel file which has 2 columns FMStyle and FMHSNum.
FMStyle is my link to the SQL table.
Here is what I have for code....
--------------------------------------------------
Update DataTEST.dbo.zzxstylr
SET hs_num = (select FMHSNum FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=c: empStyleHSCodesLoad.xls;HDR=YES ', [Sheet1$]))
Where FMStyle = zzxstylr.style
--------------------------------------------------
Everything seems to be ok except for the "Where FMStyle" is giving me a message Invalid Column name on FMStyle. Do I need to qualify FMStyle and if so how.
View 1 Replies
View Related
Jun 28, 2005
Hi
i need to sum the values in different cells of an excel sheet which im getting from data base and which is in a loop and the number of entries depends on the user.Please help me out
im adding the code please check it out:
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<html>
<body>
<%
dim objConn
set objConn=server.CreateObject("ADODB.Connection")
objConn.open "provider=SQLOLEDB;data source=10.100.17.107;initial catalog=RUT;user id=test;password=test;"
iMonth = Request.QueryString ("month")
iyear = Request.QueryString ("year")
intpid = Request.QueryString ("project")
inteid = Request.QueryString ("eid")
dim fDate
DIM fmonth
Dim fi
if iMonth = "February" and iYear mod 4 <> 0 then
iTo = 28
elseif iMonth = "February" and iYear mod 4 = 0 then
iTo = 29
end if
if (iMonth = "April" or iMonth = "June" or iMonth = "September" or iMonth = "November") then iTo = 30 end if
if (iMonth = "January" or iMonth = "March" or iMonth = "May" or iMonth = "July" or iMonth = "August" or iMonth = "October" or iMonth = "December") then iTo = 31 end if
dim rsobj1,rsobj2,rsobj5,rsobj9
sql1 = "select first_name from tblUserMaster where emp_id='"&inteid&"'"
set rsobj1 = objConn.Execute (sql1)
sql2 = "select distinct activity_id from tblTimeSheet where month='"&iMonth&"' and year='"&iyear&"' and project_id='"&intpid&"' and emp_id='"&inteid&"' and bill_non = ''"
set rsobj2 = objConn.Execute (sql2)
%>
<b>Employee Name:<%=rsobj1("first_name")%></b>
<TABLE BORDER=1>
<TR>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></td>
<TD ><%=imonth%></TD>
<TD ></td>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ><%=imonth%>
</TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ><%=imonth%></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ><%=imonth%></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
<TD ></TD>
</TR>
<TR bgcolor="#ffffff" style="FONT-FAMILY: fantasy; BACKGROUND-COLOR: powderblue">
<td ><b>Client/Assignment</b> </td>
<td ><b>ProjectName</b> </td>
<td ><b>Remarks</b></td>
<td><b>Total Hrs</b></td>
<%for i = 1 to iTo
fmonth=imonth
fi =i
fDate = fi & "/" & fMonth & "/" & iYear
Response.Write "<td align=center><b>" & i & "</p>" & weekdayname(weekday(fdate)) & "</b></td>"
next%>
</TR>
<%'===============================================d efault activity============================%>
<% do until rsobj2.EOF%>
<tr>
<%
dim intactid,rsobj3
intactid = rsobj2("activity_id")
sql3 = "select activity_name from tblActivityMaster where activity_id = '"&intactid&"'"
set rsobj3 = objConn.Execute (sql3)
sql4 = "select no_of_hrs,remarks,date from tblTimeSheet where month='"&iMonth&"' and year='"&iyear&"' and project_id='"&intpid&"' and emp_id='"&inteid&"' and activity_id='"&intactid&"'"
set rsobj4 = objConn.Execute (sql4)
%>
<td><%=rsobj3("activity_name")%></td>
<td></td>
<td><%=rsobj4("remarks")%></td>
<td></td>
<%do until rsobj4.eof%>
<%if (rsobj4("no_of_hrs") < 8 ) then%>
<td><%=rsobj4("no_of_hrs")%></td>// I need to add the values i get in this td and display in the td with red colour and the number of values may change according to the user
<%else%>
<td>8</td>
<%end if%>
<%
rsobj4.movenext
loop
%>
</tr>
<%
rsobj2.movenext
loop
%>
Thanks
ajith
View 1 Replies
View Related
Jul 26, 2007
Hi all,
I would to take a value of a cells in my matrix to load an other. Like we usually do in Excel
A2 = A1 * 100 for Example...
An idea ?
Regards,
Erwan, France
View 3 Replies
View Related
Feb 23, 2015
I have an excel file that is stored in a sharepoint document library. I am trying to use SSIS to import it into a SQL database. I use the excel connection manager with a sharepoint UNC path. When I run it from BIDS, it runs successfully. When I run it from a job, I get an error
"It is already opened exclusively by another user, or you need permission to view and write its data"
It is definitely not open by anyone else, and I have full permissions to the file. ALSO, the SQL Agent and Service acct which the job runs under, has full permissions to the file. I have tried running it under a proxy account with my user account, but it fails with the same message. Further, I can run a DIR command from a command prompt to list the sharepoint directory contents successfully, but when I run the same command from SSMS using xp_cmdshell, it fails with access denied. Again, the SQL Service acct has full rights to the sharepoint site.
I notice when i browse to the sharepoint document library and try to open the folder with "Open with Windows Explorer", it always asks me to login and I'm thinking that is related to the problem I am having - that it doesn't automatically pick up the windows authentication.
View 3 Replies
View Related
Aug 28, 2015
Declare@QRYvarchar(8000)
Select@QRY='bcp "Select COL1, COl2 From table(nolock)" queryout "D: est.xls" -c -T -S ' + convert(varchar(20), serverproperty('servername'))
Select@QRY
Execmaster..xp_cmdshell@qry
The file test.xls is getting generated but when opening getting the message
"File you are trying to open is in a different format than specified by the file extension"
Is there any property that can be set to avoid this message?
View 6 Replies
View Related
Sep 1, 2015
I am splitting data from SQL table and sending it to excel file but everytime i rerun the package ,it appends the existing data in excel file ..I tried using execute sql task with excel connection and write drop table `tablename` and then one more execute sql task with create table `tablename` (`Id` int ,`fname` varchar(100)) ....But it does not seem to work.
View 1 Replies
View Related
Sep 11, 2015
I have an .xlsx file where I need to import the data into a table. If there is not a way to do this, is there a way to import either a tab del file or different type of .csv file into the database?
Do not want to use the SSIS or import feature from SQL2008 as I tried to save the steps and running it wont work either.
View 9 Replies
View Related
May 11, 2007
MSSQL noob here. Sorry guys, but I really need some help.
I have a MSSQL (2000) database and a Products Table. Now, there was three columns used for pricing that I was not able to populate on the initial usage. So I exported the table as an Excel document, and got rid of everything except the UID (unique identifier column) the Name, and the Three columns, so that the customer could take their time in filling out the information.
Ok, so These are what are common to both the MSSQL database and the Excel sheet
column uid = unique id integer
column Name = text
column eBay = number
column PriceGrabber = number
column Amazon = number
So, any idea how I can update my Products Table with this?
Please HELP!
View 18 Replies
View Related
May 15, 2007
Hi
I'm trying to eliminate merged cells when exporting a report to Excel. My problem being my report textbox above my table.
I've searched and found that making the textbox the same width as the first column eliminates the merging. Perfect, it does. But when the report is viewed in the report viewer, the textbox can only expand vertically. So the title looks terrible because column one is not wide.
I've read that expand horizontally is not an option
I don't seem to be able to tell it not to output that text box, which would be an option if there is no other answer
I can't have the text box the size I want it, due it creating merged cells
I don't want to export it as a CSV
Are there any other options available or am missing something?
Cheers
View 5 Replies
View Related
Apr 7, 2006
Hi,
Can any tell me how to check whether any Comment been entered in a Cell in the Excel Sheet?
It is pretty urgent. Solutions are greatly appreciable.
Thanks & Regards,
Prakash Srinivasan.
View 2 Replies
View Related
Jan 9, 2013
Am not able to export more than 10 lakh records to excel sheet(2007 xlsx). I'll get sucess message but all data will not get copy to excel sheet .I have tried through import wizard in sql server and also directly copy and paste to excel sheet.
View 9 Replies
View Related
Feb 13, 2015
I have a report that is scheduled to run a once a week. This works fine. But now I would like this report to be saved as an Excel file automatically when it runs. how / where do I do this?
View 0 Replies
View Related
Jun 1, 2015
I have a package which is creating a excel file 'ExcelName.xls' and storing in 'E:ReportingDelivered_Reports'. Now I have to attach this report using send mail task and send it to given mail id. To achieve this I have configured the send mail task and in Expression Builder, I have selected the below expression:
"E:ReportingDelivered_ReportsExcelName_"+
((DT_WSTR,4)Year(@[System::StartTime]))+
RIGHT("0"+((DT_WSTR,2)Month(@[System::StartTime])),2)+
RIGHT("0"+((DT_WSTR,2)Day(@[System::StartTime])),2)+".xls"
I need file name should be 'ExcelName_20150601' where suffix is the current date. But I recieve file which name is 'ExcelName', which is the original file name.
View 7 Replies
View Related
Mar 25, 2008
Hi,
I created a report in list view (I have to use a subreport in it) and when I export it to excel the cells are shifted even in the header. The html is ok - the problem is only with export.
like this:
Title First Name Last Name Address
Mr John Smith Peartree Str.
I tried to fix the size and location on every cells, but this does'n work in export. Some of the cells drop at the next row and some of they are merged. I was able to receive some good export - but only with a lot of attempts of cells resizing.
Is there any way to avoid this shifting?
View 5 Replies
View Related
Dec 28, 2006
I have a report which was in RS 2003 and exported to Excel fine. Now when I export the same report using RS 2005 to Excel I get gray cells at the bottom of each table. I have the background of the body set to transparent. I have tried setting the background of the body to white and other colors. Those colors show up but the gray is still there as well. In preview mode and export to pdf I do not have those problems. Basically gray cells are showing up where they should not be. Any help would be great.
View 4 Replies
View Related
Jun 1, 2015
I have a SSIS package running well in production however sometimes the package will fail when the excel file contains more than 25000+ rows.
The SSIS package is run by SQL Server Agent and is set to run in 32bit mode.
I checked the data by loading in batches and all data loaded successfully. But the funny thing is when I run the same package on my local development PC using BIDS and the same data file. The package loads all 25000+ rows successfully.
Is there some setting that is preventing all rows loading in the server environment.
View 4 Replies
View Related
Oct 22, 2015
I am copying data from database to an excel file through SSIS. database is MS SQL 2005 and BIDS is also 2005.However, the job doing this task fails every time.As per investigation, the result of the query is more than 100,000 rows and we know that excel has a limit of 65000 rows of data.Is there a way of setting the limit up? or something? a better approach maybe so that everything will be copied to the excel file successfully.
The PrimeOutput method on component "Source - Query" (1) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. End Error Error: 2015-10-22 04:34:58.05 Code: 0xC0047021
Source: Data Flow Task
Description: SSIS Error Code DTS_E_THREADFAILED.
Thread "SourceThread0" has exited with error code 0xC0047038. There may be error messages posted before this with more information on why the thread has exited. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:30:00 AM Finished: 4:35:05 AM Elapsed: 304.844 seconds. The package execution failed. The step failed. "
View 1 Replies
View Related
Feb 5, 2007
Anyone know why cells within a matrix that are formatted as numeric export to Excel with a cell format proprty of "General"? Cells within a table however export with an appropriate format.
Thanks
View 1 Replies
View Related
Feb 18, 2015
Production and development servers are on different domains and they do not trust each other. How do I import data from the table t1 from a database db1 in production and load it into table t1 inside database db1 in development?
View 3 Replies
View Related
Apr 30, 2008
Hi
I have matrix, in data cells I want to perform calculation based on value in this cell and next/previous cell. Something like : "=B3-A3" in MS Excel.
How can I get the value form next/previous cell in matrix?
There is Previous function but it does'nt work in matrix. Are there workarounds?
Andriy Zhornyk
View 2 Replies
View Related
Dec 3, 2007
Hi all,
I have a basic matrix report but whenever I export this report to Excel, some of the cells end up becoming merged. Is there any way to avoid this using Reporting Services instead of formatting the cells directly in Excel?
Any help is greatly appreciated!
View 12 Replies
View Related
Jun 4, 2008
Hi All,
I have a Problem while updating one table data from another table's data using sql server 2000.
I have 2 tables named TableA(PID,SID,MinForms) , TableB(PID,SID,MinForms)
I need to update TableA with TableB's data using a single query that i have including in a stored procedure.
View 2 Replies
View Related