sql-server-2005

SQL Server 2005 For XML Explicit - Need help formatting

我是研究僧i 提交于 2019-12-23 07:15:31
问题 I have a table with a structure like the following: ------------------------------ LocationID | AccountNumber ------------------------------ long-guid-here | 12345 long-guid-here | 54321 To pass into another stored procedure, I need the XML to look like this: <root> <clientID>12345</clientID> <clientID>54321</clientID> </root> The best I've been able to do so far was getting it like this: <root clientID="10705"/> I'm using this SQL statement: SELECT 1 as tag, null as parent, AccountNumber as

Fill data grid view from sql table

佐手、 提交于 2019-12-23 06:58:16
问题 I have four columns in Datagridview . I want to fill first two columns with data from sql database. I try to fill Datagridview . It not display data, but it generate rows. This is my code: getConnect() Try Conn.Open() Dim strSQL As String = "SELECT EMP_ID, EMP_NAME FROM EMPLOYEE ORDER BY EMP_NAME ASC" Conn.Close() Dim da As New SqlDataAdapter(strSQL, Conn) Dim dt As New DataTable("EMPLOYEE") da.Fill(dt) ATCGRID.DataSource = dt Catch ex As SqlException MsgBox(ex.Message, MsgBoxStyle.Critical,

Why doesn't VFP .NET OLEdb provider work in 64 bit Windows?

戏子无情 提交于 2019-12-23 06:47:09
问题 I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb provider is not found. I researched and everything seems to point out that there is no solution. Any Help, please... 回答1: Have you tried changing the target CPU to x86 instead of

Return Select Statement as formatted HTML (SQL 2005)

这一生的挚爱 提交于 2019-12-23 06:39:07
问题 I have a data set that looks something like this: Gender | Age | Name Male | 30 | Bill Female | 27 | Jenny Female | 27 | Debby Male | 44 | Frank And I'm trying to display this as specially formatted HTML code: <ul> <li>Male <ul> <li>30 <ul> <li>Bill</li> </ul> </li> <li>44 <ul> <li>Frank</li> </ul> </li> </ul> </li> </ul> <ul> <li>Female <ul> <li>27 <ul> <li>Jenny</li> <li>Debby</li> </ul> </li> </ul> </li> </ul> I tried using FOR XML but that didn't give the results I was looking for. It

Input string was not in a correct format

笑着哭i 提交于 2019-12-23 05:50:10
问题 Input string was not in a correct format. 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.FormatException: Input string was not in a correct format. Source Error: Line 30: lbl_userName.Text = objReader.Item(0) & " " & objReader.Item(1) Line 31: lbl_resumeHead.Text = objReader.Item(3) Line 32: lbl_experience.Text =

Deleting Invalid Duplicate Rows in SQL

半腔热情 提交于 2019-12-23 05:42:05
问题 I have a table which stores the check-in times of employees through Time Machine on the basis of a username. If an employee punches multiple times then there would be multiple records of his check-ins which would only have a time difference of few seconds in between. Obviously only the first record is valid. All the other entries are invalid and must be deleted from the Table. How can i do it if i can select all the checkin records of an employee for the current date? The Data in the db is as

Deleting Invalid Duplicate Rows in SQL

只愿长相守 提交于 2019-12-23 05:42:03
问题 I have a table which stores the check-in times of employees through Time Machine on the basis of a username. If an employee punches multiple times then there would be multiple records of his check-ins which would only have a time difference of few seconds in between. Obviously only the first record is valid. All the other entries are invalid and must be deleted from the Table. How can i do it if i can select all the checkin records of an employee for the current date? The Data in the db is as

update SQl table from values in excel

我们两清 提交于 2019-12-23 05:31:12
问题 I am using the SQL Developer or SQl express. How do i get the values from an excel sheet and update those in a column of my database... Please help thanks. i have this and im running it but i get error: SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\books.xls', 'SELECT * FROM [Sheet1$]') i get error now OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.". thanks 回答1: Do you have SQL Server

Pivot the results of a stored procedure?

空扰寡人 提交于 2019-12-23 05:18:27
问题 I have a stored procedure that always returns one row. I want to convert each column_name and its corresponding value to a row. Example - ID | Name | Address ----------------------- 1 | Jim | Home should become - ID | 1 --------------------- Name | Jim Address | Home How do I do this ? 回答1: You'll need to insert the values from the stored procedure into a (temporary) table, and then unpivot from there. Psuedocode below: CREATE TABLE #t (ID int, Name varchar(100), Address varchar(100)) INSERT

SQL Server: multiple index for the same columns performance

↘锁芯ラ 提交于 2019-12-23 05:06:31
问题 I have a table Person with columns personId, teamId, departmentId , among others. Most of the query use a combination of these columns on the where. Example Select * from .. where personId = 2 and departementId = 1 Select * from .. where personId = 2 and teamId = 1 Select * from .. where departmentId = 2 and teamId = 1 My question is, should I create an index for each of these column individually? 回答1: The quick answer is yes - just add an index for each column. Its not likely to be the most