varbinary

Operand Type Clash

牧云@^-^@ 提交于 2019-12-05 00:49:07
I have a long stored procedure and when I execute the procedure I get the following error: Msg 206, Level 16, State 2, Line 1 Operand type clash: varchar(max) is incompatible with sql_variant So to trouble shoot I have printed satetement where the problem is and the code is: SELECT 'Name' , 7 , CASE WHEN 'varchar' = 'varbinary' THEN REPLACE(UPPER(sys.fn_sqlvarbasetostr([Name])), 'X', 'x') ELSE CONVERT(VARCHAR(4000), [Name]) END , 'varchar' FROM ref.dbo.datatables WHERE id = 12 ORDER BY [ID] So When I execute the above statement it is givng me the error as: Msg 206, Level 16, State 2, Line 1

Handling hashed passwords stored as varbinary in SQL Server and classic ASP

亡梦爱人 提交于 2019-12-04 17:21:33
All, Sorry in advance - I'm a novice in most of the topics below (SQL, ASP). Anyway... I've got a pretty simple web app that requires users to log in with a user name and password. The front end creates a salted SHA1 hash of the password, and posts it (along with the user's name) to an ASP page. That ASP page takes the data, calls a stored procedure in the SQL Server database, and passes the users name and hashed password; the stored procedure writes the info to the 'users' table. The password column's type in the table is varbinary. As far as I can tell, when the ASP gets the password

How to improve performance in SQL Server table with image fields?

不想你离开。 提交于 2019-12-04 06:21:17
I'm having a very particular performance problem at work! In the system we're using there's a table that holds information about the current workflow process. One of the fields holds a spreadsheet that contains metadata about the process (don't ask me why!! and NO I CAN'T CHANGE IT!!) The problem is that this spreadsheet is stored in an IMAGE field in an SQL Server 2005 (within a database set with SQL 2000 compatibility). This table currently has 22K+ lines and even a simple query like this: SELECT TOP 100 * FROM OFFENDING_TABLE Takes 30 seconds to retrieve the data in Query Analyser. I'm

How to Perform a Replace on Varbinary data in SQL

放肆的年华 提交于 2019-12-02 18:31:23
问题 I've never had to do this before but I'm looking to do a SQL replace on varbinary data. I'm trying this but it's not successfully replacing, I think because it's treating the data as varchar and then cast back to varbinary. This stemmed from blank spaces at the end of these values but are not actual 'spaces' so RTRIM doesn't work in this scenario (bold below). Example of Data trying to change:

Saving image to database as varbinary (silverlight)

梦想与她 提交于 2019-12-02 04:15:57
Today I have been trying to get an image to save into a database, and I really can't figure it out. I have made the following table ( Afbeeldingen ): id:int afbeelding1:varbinary(max) Imported it with a Linq-to-SQL class, wrote a WCF service for it: [OperationContract] public void setAfbeelding(Afbeelding a) { dc.Afbeeldings.InsertOnSubmit(a); dc.SubmitChanges(); } And then in my xaml page I try to to create an Afbeelding , but I can't put the Byte[] as a varbinary . I don't know how to do this and I can't seem to find anything about it. OpenFileDialog openFileDialog = new OpenFileDialog();

Update varbinary(MAX) field in SQLServer 2012 Lost Last 4 bits

落花浮王杯 提交于 2019-12-02 04:09:28
问题 Recently I would like to do some data patching, and try to update a column of type varbinary(MAX) , the update value is like this: 0xFFD8F...6DC0676 However, after update query run successfully, the value becomes: 0x 0 FFD8...6DC067 It seems the last 4 bits are lost, or whole value right shifting a byte... I tried deleting entire row and run an Insert Query , same things happen! Can anyone tell me why is this happening & how can I solve it? Thanks! I have tried several varying length of

Update varbinary(MAX) field in SQLServer 2012 Lost Last 4 bits

╄→尐↘猪︶ㄣ 提交于 2019-12-02 00:13:11
Recently I would like to do some data patching, and try to update a column of type varbinary(MAX) , the update value is like this: 0xFFD8F...6DC0676 However, after update query run successfully, the value becomes: 0x 0 FFD8...6DC067 It seems the last 4 bits are lost, or whole value right shifting a byte... I tried deleting entire row and run an Insert Query , same things happen! Can anyone tell me why is this happening & how can I solve it? Thanks! I have tried several varying length of binary, for maximum 43658 characters (Each represents 4 bits, total around 21 KB), the update query runs

Using variable to specify 'size' when declaring a VARBINARY

試著忘記壹切 提交于 2019-12-01 19:12:08
问题 In SQL Server (2008 R2), instead of doing this: DECLARE @testVar VARBINARY(64); I would like to do this: DECLARE @varSize INT; SET @varSize = 64; DECLARE @testVar VARBINARY(@varSize); But I get this error: Incorrect syntax near '@varSize'. How can I do something like this or force SQL to evaluate @varSize? 回答1: For a variable, why don't you just use MAX? DECLARE @testVar VARBINARY(MAX); This isn't the 70s anymore. Your system can handle it. In fact if what you want to do were possible, I

MySQL case insensitive search on varbinary field?

雨燕双飞 提交于 2019-12-01 17:12:48
I have a varbinary field id like to do a case-insensitive search on. I know that the way varbinary fields work prohibits you from doing something like so: WHERE LOWER(page_title) = LOWER("Gasket") So is there a way to do this? I imagine I could temporarily cast the field as a varchar or something. But I'm not sure. You can use the CONVERT() function: SELECT * FROM mytable WHERE CONVERT(page_title USING latin1) = 'gasket'; See also Case Sensitivity in String Searches 来源: https://stackoverflow.com/questions/6807839/mysql-case-insensitive-search-on-varbinary-field

MySQL case insensitive search on varbinary field?

一笑奈何 提交于 2019-12-01 16:19:12
问题 I have a varbinary field id like to do a case-insensitive search on. I know that the way varbinary fields work prohibits you from doing something like so: WHERE LOWER(page_title) = LOWER("Gasket") So is there a way to do this? I imagine I could temporarily cast the field as a varchar or something. But I'm not sure. 回答1: You can use the CONVERT() function: SELECT * FROM mytable WHERE CONVERT(page_title USING latin1) = 'gasket'; See also Case Sensitivity in String Searches 来源: https:/