I have a load of records to store in a SQL Server 2008 database. Each of the records has a SHA-1 hash. Obviously storing the SHA in String form will take up 80 bytes compared to 20 if stored as Bytes.
When quering the database, which is SQL better at:
Comparing Strings?
Comparing Binary?
I need help deciding how to store the hashes ...
I've been reading up on web services and SQL servers lately.
Basically, what I need is to access a SQL 2008 Server from the iPhone, so I go about creating SOAP web services as per http://www.developer.com/net/asp/article.php/10917_3767311_1/Creating-Native-Web-Services-in-SQL-Server.htm
Next, I access the data using the tutorial found ...
I have the scenario like this,
My environment is .Net2.0, VS 2008, Web Application
I need to lock a record when two members are trying to access at the same time.
We can do it in two ways,
By Front end (putting the sessionID and record unique number in the dictionary and keeping it as a static or application variable), we will relea...
I want to change the primary key value for one row in a table that has relations with other tables:
For example
Table Person { Id, Name, +50 fields }
Table Address { Id, City, +10 fields }
Table Person2Address { Id, PersonId, AddressId }
I want to change Person.Id and Person2Address.PersonId
I try something like:
BEGIN TRANSACTIO...
I want to delete and modify previously created triggers but i cant find them anywhere in database. Where they exist and how to edit or delele them
...
Why this update statement is not getting compiled ? According to the msdn it is perfectly right.
UPDATE dbo.UserProperties
SET Value = MergeFrom.Value
FROM dbo.UserProperties MergeFrom ,
dbo.UserProperties MergeTo
WHERE MergeFrom.Field = MergeTo.Field
AND MergeTo.[Key] = CAST(@MergeToUserID AS NVARCHAR(50))
...
I have a script to update my database for a new release of my web app . In this update i need to alter a strored procedure. I have an ALTER PROCEDURE script that works fine when run on its own, however when I drop it into my update script and run it I get the errors "Incorrect syntax near the keyword 'PROCEDURE'." and "Must declare the s...
i went to: menu > tools >options > fonts and colors > business intelligence designers...but nothing happened when i changed the font size. i'm using visual studio 2008
what am i missing here?
...
Hello,
I got an error "Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables", since there are ntext fields in original table, I had attached a trigger to.
Here is a solution: http://lazycodeprogrammer.blogspot.com/2009/08/how-to-use-inserteddeleted-with.html
But original (non modified) query is complex enoug...
I am thinking to use a GUID in my .net app which uses SQL Server. Should I be writing a stored procedure which generates the GUID on each record entered or should I be directly generating it from the application.
Reasons for asking the question (If am wrong correct me in this):
I (as/pre)sume:
When generating the GUID from the databas...
I have a table where each record has a Table_Name (name of a table). I then use a Cursor to select all table names related to some record in to a Cursor. Then I do a WHILE for each table name in the Cursor to do some job.
I want to know if it's possible to solve this problem without using a Cursor.
DECLARE tables_cursor CURSOR FAST_FOR...
Hi! I am trying to create trigger on SQL Server 2008. I want that if i update field in tabele log that the new value update field in another table Doc. This is the code for trigger:
Create TRIGGER dbo.DocSt
ON dbo.log
AFTER UPDATE
IF (SELECT COUNT(*) FROM inserted) > 0
BEGIN
IF (SELECT COUNT(*) FROM deleted) > 0
...
Hi,
I have a table in sql server 2005 which holds an ip range and the corresponding info (country / city / etc). There are approximately 3 million rows and it currently takes just over half a second to return a record based on the query below.
DECLARE @ip BIGINT
SELECT @ip=3561360969
SELECT TOP 1 id, ipfrom, ipto, countrycode, countr...
There is a text field called myDate. This field can contain either 1) 'Fiscal year ending someDate' or 2) 'dateA to 'dateB'.
In situation 1), I want to set the field date1 = to someDate.
In situation 2), I want to set the field date1 = dateA and the field date2 = dateB.
All the dates (someDate, dateA, dateB) can be written as 1/1/2000...
(This post is soliciting personal experiences about storing XML; please share what you know. :-) )
I am working on a service application that communicates with an external service using XML. I am planning to use SQL Server 2008 to store the XML that is received and sent to the external service. I'm exploring my options for storing ...
I have a SQL Server 2005 database with several tables. One of the tables is used to store timestamps and message counters for several devices, and has the following columns:
CREATE TABLE [dbo].[Timestamps] (
[Id] [uniqueidentifier] NOT NULL,
[MessageCounter] [bigint] NULL,
[TimeReceived] [bigint] NULL,
[DeviceTime] [bigint] NULL,
[Devic...
I want to return columns based on some meta data in an other table. i.e. i have my table which contains 10 columns, and another table which contains those columns denormalise with metadata to do with them.
i.e.
Table - Car:
columns - Make,Model,Colour
and another table called "Flags" which has a row for each of the above columns and e...
If I have:
<quotes>
<quote>
<name>john</name>
<content>something or other</content>
</quote>
<quote>
<name>mary</name>
<content>random stuff</content>
</quote>
</quotes>
How do I get a list of the element names 'name' and 'content' using T-SQL?
The best I've got so far is:
declare @xml xml
set @xml = ...
sele...
Hi,
I am a SQL Server DBA and have a database that I would like to access via a web browser. It will be used internally on the intranet and will simply be calling stored procedures in SQL Server to enter data into the database and return data into a simple web page. I am not a developer although I'm pretty good at SQL and scripting with...
I have the following tables:
tblPerson:
PersonID | Name
---------------------
1 | John Smith
2 | Jane Doe
3 | David Hoshi
tblLocation:
LocationID | Timestamp | PersonID | X | Y | Z | More Columns...
---------------------------------------------------------------
40 | Jan. 1st | 3 | 0 | 0 | 0 | M...