What Size To Make The Binary Field?
Jul 12, 2006
Hi,
I have asked this question on 3 forums now and never get an answer, I don't know what is so hard about this question but I will try it here.
I am using SHA512 in C# to convert a password and its salt to hashed. I need to store the password hash and the salt hash in the database in two fields. I was told to use binary field to store the hash data and that the output of SHA512 would ALWAYS be the same no matter how long the password is.
I modified this hash example to use only SHA512 and to work with byte array instead of plain text.
All I need to know now is what size I need to make my binary field to hold this password that is hashed.
http://www.obviex.com/samples/Code.aspx?Source=HashCS&Title=Hashing%20Data&Lang=C%23
Say I have a password which is 30 characters max, and a salt which is 16 characters max. The password and the hash are stored in seperate fields in the same table. They are both hashed using SHA512 and are both being stored as byte arrays in C#, what size to I need to make the binary data type in order to hold the password, and to hold the salt.
Thanks!
View 4 Replies
ADVERTISEMENT
Dec 17, 2001
is there any way i can make a field in a table accomodate more than 1023 charcters? i used the 'varchar' datatype and used a length of 2500, but still, I can't fill up a field with more than 1023 characters. Is there any way to change it?
Also, is there any way to used a symbol or special character in a field? Can SQL server identify such a character? like the alpha or beta symbol...
Thank you...
View 1 Replies
View Related
Jul 23, 2005
Hi ,Have a Visual C++ app that use odbc to access sql server database.Doing a select to get value of binary field and bind a char to thatfield as follows , field in database in binary(16)char lpResourceID[32+1];rc = SQLBindCol(hstmt, 1, SQL_C_CHAR,&lpResourceID,RESOURCE_ID_LEN_PLUS_NULL , &nLen1);and this works fine , however trying to move codebase to UNICODE antested the followingWCHAR lpResourceID[32+1];rc = SQLBindCol(hstmt, 1, SQL_W_CHAR,&lpResourceID,RESOURCE_ID_LEN_PLUS_NULL , &nLen1);but only returns 1/2 the data .Any ideas , thoughts this would work fine , nit sure why loosing dataAll ideas welcome.JOhn
View 2 Replies
View Related
Nov 1, 2006
Here is my code:
Dim oParameter As New System.Data.SqlServerCe.SqlCeParameter("@pMyParameter", SqlDbType.Binary, 3000)
If you set a watch on this object, the size is set back to 510. I have tried resetting the size back to 3000 after construction using oParameter.Size, but it doesn't change from 510. If the command is executed using ExecNonQuery, this causes the bytes to get cut off at 510 bytes and returns the error: Byte array truncation to a length of 510.
Can I insert data into SQL Server 2005 Mobile Edition, into a field of data type binary(3000) using .NET CF 2.0 via SqlServerCe objects?
Thanks for any help.
Kirk
View 1 Replies
View Related
Jun 1, 2008
Application is ocr'ing tiff image files and then storing the resultant text data in a text field in SQL 2005 database. This field is then used with the full text catalog.
All works fine,
However, am I using the correct field type to store the text files for efficiency and space saving?
If I use a binary field, does this reduce the size of the database by compressing the text data in the binary field? Also, is there a limit as to the size of text file that I could store in a binary field?
It would be good to get feedback on this before I go too far down the wrong road.
So, text field to store the text data or binary field to store the actual text file?
View 12 Replies
View Related
Apr 16, 2002
Hi all,
I found a database file and a log file over 2G on mssql 2000 server. Actually, they only need around 200M. I try to backup, truncate the database in order make the size smaller. But the size cannot be smaller. How can I do it?
Simon
View 3 Replies
View Related
Nov 15, 2006
hi
I have used the following code (mostly created by MSDN) to retrive a binary field from SQL database. it works but I have extra space between characters. for example if I save a text file with "Hello world" text, after retriving I have it like "H e l l o w o r l d". what is the problem??????
I am really looking forward your answers
private void retrive()
{
public void a()
{
SqlConnection connection = new SqlConnection("Some Connection string");
SqlCommand command = new SqlCommand("Select * from temp", connection);
// Writes the BLOB to a file
FileStream stream;
// Streams the BLOB to the FileStream object.
BinaryWriter writer;
// Size of the BLOB buffer.
int bufferSize = 50;
// The BLOB byte[] buffer to be filled by GetBytes.
byte[] outByte = new byte[bufferSize];
// The bytes returned from GetBytes.
long retval;
// The starting position in the BLOB output.
long startIndex = 0;
// Open the connection and read data into the DataReader.
connection.Open();
SqlDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess);
while (reader.Read())
{
// Create a file to hold the output.
stream = new FileStream(
"C:\file.txt", FileMode.OpenOrCreate, FileAccess.Write);
writer = new BinaryWriter(stream);
// Reset the starting byte for the new BLOB.
startIndex = 0;
// Read bytes into outByte[] and retain the number of bytes returned.
retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize);
// Continue while there are bytes beyond the size of the buffer.
while (retval == bufferSize)
{
writer.Write(outByte);
writer.Flush();
// Reposition start index to end of last buffer and fill buffer.
startIndex += bufferSize;
retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize);
}
// Write the remaining buffer.
if (retval != 0)
writer.Write(outByte, 0, (int)retval - 1);
writer.Flush();
// Close the output file.
writer.Close();
stream.Close();
}
// Close the reader and the connection.
reader.Close();
connection.Close();
}
}
View 1 Replies
View Related
Sep 19, 2005
Can anyone point me in the right direction to find documentation for the problem below?I need to store and retrieve ten fields of 16-bits each for testing 16 true-false conditions (a total of 160 bits in each record) so I think I'd like to use ten 2-byte binary fields (160 "bit" fields would be quite unmanageble, if even possible [I think there is some kind of limit to the number of fields in a single record]). I'm not quickly finding in the SQL Server's online documentation how to test for, use and update binary fields. I'll keep looking, but can anyone point me in the right direction? I'm using VB, if that makes any difference.
View 1 Replies
View Related
Apr 26, 2007
I want to have an SSIS package that processes a file in the normal insert, update style. But at the end I want to store the file as a binary field to another table for archive purposes. I am having trouble finding a good way to do this. Any samples, ideas, or articles would be appreciated.
View 8 Replies
View Related
Sep 21, 2007
I have a weird problem.
We are importing a very small subset of a big desktop database into a CE database on a mobile device for an occasionally connected application. The idea is that the mobile device can use this CE database as a fall back database in case we are not connected.
The database is a very simple list of barcodes.
Basically a single field as primary key
EAN13 bigint
When we import 200K rows (yes we have quite a lot of them). The database is 7MB!!!! A bit big I would say since 8 bytes times 200.000 is only 1.5 MB. Where does the extra space come from?
Yes I did compact the database after the import
View 1 Replies
View Related
Oct 31, 2007
I am calling my report logo image via http: url
the moment the image is loaded to image control, it is changing its height and width.
how can i make it fixed and the image to be resized appropriately to fit the image control.
Thank you very much, for the help.
View 1 Replies
View Related
Nov 6, 2006
hello dear friends
I am trying to save a binary file to database with the following code:
public static void memorystreamToDb()
{
MemoryStream mst = new MemoryStream();
UnicodeEncoding u = new UnicodeEncoding();
string Textn = "Test";
byte[] b = u.GetBytes(Textn);
mst.Write(b ,0,Textn.Length );
BinaryReader reader = new BinaryReader(mst);
byte[] file = reader.ReadBytes((int)mst.Length);
using (SqlConnection connection = new SqlConnection("Some Connection String"))
{
SqlCommand command = new SqlCommand("INSERT INTO temp (examplefile) Values(@File)", connection);
command.Parameters.Add("@File", SqlDbType.Binary, file.Length).Value = file;
connection.Open();
command.ExecuteNonQuery();
}
reader.Close();
mst.Close();
}
or with the other method from a real file (not memory stream)
public static void Addfile(string path)
{
CommonMethods_class k = new CommonMethods_class();
byte[] file = GetFile(path);
using (SqlConnection connection = new SqlConnection(k.Get_connection_string()))
{
SqlCommand command = new SqlCommand("INSERT INTO temp (examplefile) Values(@File)", connection);
command.Parameters.Add("@File", SqlDbType.Binary, file.Length).Value = file;
connection.Open();
command.ExecuteNonQuery();
}
}
and after running each of them seams that the file have been saved; but I can not retrive the files. I have tried some solutions from msdn but inside the created file is empty. the point that i really look for it is to just working with memory not in the disk before saving. and then retriving each field that I want.
looking forward your points
thank you in advance
View 2 Replies
View Related
Feb 16, 2004
i need to store a bmp or zipped file in a field of a ms sql db. i read the file using vb6 o.net, and in my mind i think sto store it in binary mode. the files could be more of 12 mega. whitch kind of field a could use?
View 1 Replies
View Related
Jul 23, 2005
This may be a stupid question but I can't find an easy answer for what Iwant to do. I need a blob data field that can store both binary and textdata like the sql_variant field. I am using vb.net to populate a sql table.I want to store both string and binary data.
View 1 Replies
View Related
May 8, 2007
Hi all,
i have "String or binary data would be truncated" error when i try to execute an insert statment.
can i find witch field is affected by this error? (for return it to the user)
thank's all
View 34 Replies
View Related
May 22, 2015
How to make SSRS report page size dynamic, or in a way where viewer can set it to the size they want?
Set to 0
View 2 Replies
View Related
Jul 31, 2007
if a customer can have up to 10 acounts and each account has a balance,
in customer_account table, the same custID repeats and relates to an
accountID and each account has its own balance.
How to display each customer in ONE row and list his account one next to another ?
for example:
custID, acct#1, acct#1Balance, acct#2, acct#2Balance, acct#3, acct#3Balance
how to do write SQl to achive it ?
This is chanllenging to me...
Your advise is greatly appreciated !
View 3 Replies
View Related
Nov 7, 2007
I am doing a shopping basket type demo.I have difficulties going from table with fields like (Name,ProductCode) to table(Name, ProductCode, NumberOfItems). One way could be adding just Name and ProductCode fields and let NumberOfItems come automatically. It could have some common value like 1. How should I do this with VB.
View 1 Replies
View Related
Mar 28, 2006
Hiim new to ms sql server, having previously used mysql. How do i make a auto number field? What datatype shall i use for it? like autonumber for mysql. Ive tried setting my primary key field to uniqueidentifier data type but then i still need to manually add a guid key in there. i want it so it automatically generates a unique key everytime i add a new row. is this possible?!hope someone can help!thanks
View 2 Replies
View Related
Feb 8, 2007
Hi there!
I'm using a Switch statement in my SQL as follows:
Code:
SELECT symbol,
Switch(timestamp Is Null,Null,
timestamp <= 005959, 0,
timestamp<=235959,23) AS period
INTO averageprice
FROM stocktrades;
Now here's my problem. The Data Type stored in the 'period' field of this new table I've created, dubbed averageprice, is a Text field and I want it to be a Number field. I've tried my best to figure this out and I'm still looking so any helpful hints or solution would be greatly appreciated. Thanks!!!
View 1 Replies
View Related
Mar 13, 2007
Hi,
How to make (int) Identity auto increment field showed like
0001
0002
0003
0004
...
View 1 Replies
View Related
Jul 20, 2005
Hallo !I have a Table with a column "ordernumber"ordernumberA12A45A77A88Is it possible to create a stored procedure which makes a string of these column ?Result: string = ('A12','A45','A77','A88')Thanks !aaapaul
View 3 Replies
View Related
May 19, 2008
Hi
I am using SQL Server 2008 SSRS Feb CTP
I am using a standard graph report where i want to hide some of the series fields.
This is not working at all.
I hid all the series fields but all were still showing.
Is this a bug in SQL 2008 or am i missing something.
All i did was right click on the series -> Series Properties -> Visibility -> Select Hide
Thanks in Advance
View 1 Replies
View Related
Jan 14, 2007
Hi,
SELECT UserID, UserName, Password, PublisherID, CurrencyFROM [User]WHERE (Password = 'Anitha') I am using the above mentioned it is working but int the password field i had given it as anitha. Now the querry is retriving the record for anitha, it shouldnot happen. The querry should retrive the record of anitha only for where condition anitha and not for Anitha or ANITHA etc..
Thanks
Vishwanath
View 4 Replies
View Related
May 5, 2015
I have a table where i have to make a check constraint that states the first 3 characters of the customerid field must be the first 3 characters of the company name I am so lost I looked everywhere.
View 2 Replies
View Related
May 22, 2014
Server is SQL 2000
I have a table with 10 rows with a varbinary column
I wish to concatenate all the binary column into a single binary column and then write that to another table within the database. This application splits a binary file (Word or PDF document) into multiple segments (this is Column2 as below)
example as follows
TableA
Column1 Column2 Column3
aaa 001 <some binary value>
aaa 002 <some binary value>
aaa 003 <some binary value>
aaa 004 <some binary value>
aaa 005 <some binary value>
desired results in TableB
Column1 Column2
aaa <concatenated value of above binary columns>
View 9 Replies
View Related
Mar 23, 2008
After reading Dan Guzman's blog entry (http://weblogs.sqlteam.com/dang/archive/2008/02/21/Dont-Bloat-Proc-Cache-with-Parameters.aspx) I started modifying some of my code to try it out and ran into a stumbling block. What size would you specific for a varchar(MAX) field?
Since a varchar max field can hold up to 2 billion chracters I really don't think I need to specify 2 billion as the size. Anyone have any ideas?
View 2 Replies
View Related
Mar 28, 2005
Hi,
I have MSDE installed on my computer and I'm using Web Data Administrator to manage my databses. The problem is that whenever I add a column with a length of more than 8000, I get the following error:
Length must be between 0 and 8000
If I create the column programmatically then i get this error:
The following error occured while executing the query:
Server: Msg 131, Level 15, State 2, Line 2
The size (8005) given to the column 'Article' exceeds the maximum allowed for any data type (8000).
I need several columns that can hold around
32,000 characters. What's the deal? Is this a limit with MSDE, or am I
missing something?
Thanks
View 9 Replies
View Related
Sep 11, 2006
Hi,
what happens when the autonumber field becomes bigger than MAX_INT?
If I get arithmetic overflow, how i can avoid this problem?
Thanks in advance
-december
View 2 Replies
View Related
May 9, 2008
I have set up transaction replication between two databases. Data from a table in the first database is replicated to the same table in another database.
The table at the publisher already has some data in it. The table at the subscriber is empty. When the replication is synchronizing, I get the following errors in the replication monitor:
*The process could not bulk copy into table "dbo"."virtualdatalocations_waitingqueues". (Source: MSSQL_REPL, Error number: MSSQL_REPL20037) Get help: http://help/MSSQL_REPL20037
*Field size too large
The table looks like this:
CREATE TABLE virtualdatalocations_waitingqueues (
dataid int ,
personid int ,
queueid int ,
CONSTRAINT FK_vw_dataid
FOREIGN KEY(dataid) REFERENCES datalocations(id) ON DELETE CASCADE ,
CONSTRAINT FK_vw_personid
FOREIGN KEY(personid) REFERENCES persons(id),
CONSTRAINT FK_vw_queueid
FOREIGN KEY(queueid)REFERENCES waitingqueues(id)
);
It used to run fine in the past. I couldn't find any help on google or on forums.
Any help or comments are greatly appreciated.
View 6 Replies
View Related
May 26, 2005
Hi,I am using MSDE together with Enterprise Manager.I have a table with a field named description.This field will be filled by a web forms's textbox web control.The textbox's maxsize attribute is set to "3000" characters.What size do I have to adjust for my DB field description?Is the size of 3000 in Enterpise Manager equal to 3000 characters for the textbox?I am just trying to avoid errors if MSDE cuts off the string that comes from the textbox webcontrol.
View 4 Replies
View Related
Jan 19, 2006
How do I find the current size of each field in a table's column?
I have a table with a field for notes/memos. I need to see which ones are about to reach the size limit and what the current size is.
Does this make sense?
Thank you,
Karen
View 2 Replies
View Related
Jul 7, 2006
We have a small table of about 13 million rows that needs altered. A column in the table needs to be changed from a varchar(20) to a varchar(500). When we ran the alter table script, 3 hrs later and it wasn't done running. Any suggestions on what we can do to speed up the process?
Thanks ahead of time
DMW
Edit:
We are running SQL Server 2000 and the db at the time was running in simple mood
View 1 Replies
View Related