sql-server-2005

How to display image from sql server in ms access

痞子三分冷 提交于 2020-01-06 22:42:48
问题 I have an MS sql server database. There is a table with one of the column of the "image" type. Now, the customer wants to read the data from an MS access. He wants to display the images in a form. I have never used access and have no idea of how to do simple things there. Any help will be greatly appreciate. Thanks, Ramjee 回答1: You can put regular Image control on form and state MyPic.PictureData=PicField in Current event. Or you can use AccessImagine, which is great for pictures in MS Access

SQL Server stored procedure convert varchar to int

非 Y 不嫁゛ 提交于 2020-01-06 20:15:46
问题 I have a stored procedure which need to run IN statement. I want to know a way to convert a string (list of comma separated integers) to int. In this example, positionID needs to be converted. Please help. Thanks Here is my stored procedure: Create PROCEDURE [dbo].[spCount] @year varchar(50), @positionID varchar(50) AS BEGIN Select ApplicantID, [Name], PositionID, COUNT(*) AS Votes FROM dbo.vwLog WHERE Year = @year And PositionID in (@positionID) GROUP BY ApplicantID, [Name], PositionID Order

How to parse a date from an SSIS Excel filename

六月ゝ 毕业季﹏ 提交于 2020-01-06 18:09:01
问题 I want to use the foreach container to iterate through a folder matching something like: "Filename_MMYYYY.xls". That's easy enough to do; but I can't seem to find a way to parse the MMYYYY from the filename and add it to a variable (or something) that i can use as a lookup field for my DimDate table. It seems possible with a flat file data source, but not an excel connection. I'm using Visual Studio 2005. Please help! 回答1: Do I understand correctly that you want to take your filename,

How to parse a date from an SSIS Excel filename

末鹿安然 提交于 2020-01-06 18:08:49
问题 I want to use the foreach container to iterate through a folder matching something like: "Filename_MMYYYY.xls". That's easy enough to do; but I can't seem to find a way to parse the MMYYYY from the filename and add it to a variable (or something) that i can use as a lookup field for my DimDate table. It seems possible with a flat file data source, but not an excel connection. I'm using Visual Studio 2005. Please help! 回答1: Do I understand correctly that you want to take your filename,

Syntax for xquery with namespace in the node

白昼怎懂夜的黑 提交于 2020-01-06 16:26:01
问题 We are trying to get IdValue from sql query. We are using sql server 2005. DECLARE @MyXML XML SET @MyXML = '<Candidate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ns.hr-xml.org/2007-04-15"> <CandidateProfile> <ProfileId> <IdValue>9499063</IdValue> </ProfileId> </CandidateProfile> </Candidate>' SELECT @MyXML.value('Candidate[1]/CandidateProfile[1]/ProfileId[1]','varchar(10)') AS Id This is not working because of the name

Syntax for xquery with namespace in the node

天大地大妈咪最大 提交于 2020-01-06 16:25:18
问题 We are trying to get IdValue from sql query. We are using sql server 2005. DECLARE @MyXML XML SET @MyXML = '<Candidate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ns.hr-xml.org/2007-04-15"> <CandidateProfile> <ProfileId> <IdValue>9499063</IdValue> </ProfileId> </CandidateProfile> </Candidate>' SELECT @MyXML.value('Candidate[1]/CandidateProfile[1]/ProfileId[1]','varchar(10)') AS Id This is not working because of the name

SQL Update of one table based on values in cursor of another table

微笑、不失礼 提交于 2020-01-06 15:41:57
问题 The mark on my forehead from the wall is getting too red, so posting hear.... I have a two tables and need to update values of one based on selection criteria of another. I know I can use an update with a "where exists", but I have many updates to loop through. So I am trying to use a cursor to put the values from one table into vars and then use an update on the other table with these vars. No errors are occurring, but also no updates. When I change the code to a Select statement, it shows

How to update distinct column in SQL Server 2005?

时光总嘲笑我的痴心妄想 提交于 2020-01-06 15:17:42
问题 In my table I have a column Segment_No which has duplicates. Now I want to update those duplicates. For example: the value 249X5601 is present in two rows. I want to change the second value to 249X5601R 回答1: The general form would be as follows: ;with AllRows as ( select Donation_ID,Registration_No,Segment_No, ROW_NUMBER() OVER ( PARTITION BY Segment_No order by <Suitable_Column> ) as rn from UnnamedTable ) update AllRows set Segment_no = <New_Value> where rn > 1 Where <Suitable_Column> gives

How to make FOR XML PATH not choke on ASCII Control Codes

牧云@^-^@ 提交于 2020-01-06 15:16:34
问题 If I execute the code below in SQL Server 2005: stuff(( SELECT char(31) + RTRIM(LTRIM(RTRIM(LTRIM(RTRIM(LTRIM(RTRIM(LTRIM( u.GivenName)) + ' ' + LTRIM( u.MiddleName))) + ' ' + LTRIM( u.FirmSurName))) + ' ' + LTRIM( u.NameTitle))) FROM my_database.my_schema.my_table u FOR XML PATH(''),TYPE).value('.','nvarchar(max)') ,1,1,'') I get this error: FOR XML could not serialize the data for node 'NoName' because it contains a character (0x001F) which is not allowed in XML. To retrieve this data using

how to pivot rows to columns

主宰稳场 提交于 2020-01-06 14:58:30
问题 Every example of using PIVOT in MSSQL shows people using this to aggregate data. I'm trying to exploit this to just simply transpose rows to columns For instance, consider the follwoing data SELECT 11826 ID,cast('64 ' as varchar(1000)) as answer,75098 QuestionID,2785 CollectionID into #temp insert into #temp SELECT 11827 ID,cast('Security ' as varchar(1000)) as answer,75110 QuestionID,2785 CollectionID insert into #temp SELECT 11828 ID,cast('42 ' as varchar(1000)) as answer,75115 QuestionID