For primary keys on a large SQL Server 2008 data table, I have the choice of using guids or a string of about the same size.
Performance-wise, how does a guid (16 bytes) compare to a string of about 16 chars, when doing joins, selects, etc. Is SQL better at handling guids because internally they are represented as a number?
...
Hi All,
Hope you all are doing well.
I need to import an XML-feed from a website to my SQL Server database. I don't know much about XML.
The feed structure is an bit complex. Here is the sample of that file:
<line_feed>
<FeedTime>1279519582927</FeedTime>
<lastContest>4103839</lastContest>
<lastGame>58629754</lastGame>
<events>
<event...
Hello all,
Defining a column to be a primary in table on SQL Server - will this make inserts slower?
I ask because I understand this is the case for indexes.
The table has millions of records.
Thanks all for any help
...
I have a table Customer with 2 columns Name and Surname (sql Server 2008). User wants to search by Name-Surname - or just typing Jo Bloggs. Suppose a row is filled with
CustomerId Name Surname
1 Jo Bloggs
doing
select * from customer where Name like '%Jo%' will find the records
select * fr...
I'm programming a webpage in ASP.NET which displays a list of students not listed as participants in something, and upon clicking a student name shows you a brief summary of their details, so the user can ensure they're selecting the right person.
My code currently correctly obtains their ID, adds it as a parameter to my stored procedur...
Hello,
We have a Windows VPS server using SQL Server 2005 for our e-commerce site.
A while back we were suffering from attempts to access the database remotely so someone made changes so that only the IP of the server itself could access data. That was about 18 months ago and everything has been fine since.
However, we now have a seco...
Please help me with this:
This code works fine except for cases in which the control goes inside the IF block of "NOT EXSISTS", then any query run after the execution of this block causes the sql connection to forcibly get closed, although the results from the running of this code block are correct. I can not run other queries after run...
Programs used:
SQL Server 2000, Excel 2003
We have a table in our database called Samples. Using the following query...
SELECT [Sample], [Flag] FROM Samples
ORDER BY [Sample]
... we get the following results:
Sample Flag
---------- ----
12-ABC-345 1
123-45-AB 0
679-ADC-12 1
When the user has the same da...
I am using an OLEDB source to call a stored proc to grab a set of rows each marked with either I U or D by doing a UNION between three SELECT statements in a stored procedure.
A is a table populated with data brought over from a legacy system every night. B is our system's data we want to keep updated with the legacy system's data.
SET...
Hi!
Apologies for the fuzzy title...
My problem is this; I have a SQL Server table persons with about 100.000 records. Every person has an address, something like "Nieuwe Prinsengracht 12 - III". The customer now wants to separate the street from the number and addition (so each address becomes two or three fields). The problem is tha...
Has anyone study the performance impact (positive or negative) of using Data Protection Manager as a backup and recovery tool for SQL Server?
...
I'm trying to a big insert of records into a table that is fulltext indexed. I have change tracking set to auto.
The records are inserted from another table, in numbers typically about 50,000 at a time. On SQL Server 2008 this takes something like 5 seconds to complete. But running on our live 2005 environment this takes upwards of 10 m...
I currently have this code:
/// <summary>
/// This is an ineffecient method of getting a tenant by their id.
/// </summary>
/// <param name="id">int ID of the tenant to be selected</param>
/// <returns>Tenant with the specific ID, or null if not found.</returns>
public static Tenant GetTenantByID(int id){
...
I'd like to issue the following command through SQLCMD:
IF DB_ID('My_DB') IS NOT NULL DROP DATABASE My_DB
There are a few caveats though...
The database name is dynamic
The program which is running the command (BuildForge) will not replace a variable if it appears within single quotes
So, I can't use:
-Q"IF DB_ID('${db_name}') IS...
Coming from an Oracle background, Oracle's SQLPlus would let you indicate a variable. If the variable wasn't set, you'd be prompted to provide a value.
I'm using SQLCMD, using the $([var_name]) syntax. In SSMS SQLCMD mode, I get:
A fatal scripting error occurred.
Variable tbl_name is not defined.
...for trying to run:
SELECT ...
Is there a way to select the row from a temp table (table has only one row anyway), into another table that has some columns with differenet names? For example:
TempTable
FirstName LastName Column1 Column2
------------ ------------ ----------- -----------
Joe Smith OKC ...
I've just moved a database from a SQL 2000 instance to a SQL 2008 instance and have encountered an odd problem which appears to be related to IDENTITY columns and stored procedures.
I have a number of stored procedures in the database along the lines of this
create procedure usp_add_something @somethingId int, @somethingName nvarchar(1...
How can I multiply two types?
I have one column with cost of type money. Another column that has the number of those products of type integer.
How can I multiply these two values to result in a value representing the cost?
Example: $2000 * 2
...
I am trying to execute a humongous query with close to 200 inner joins on a database. It gives me the following error
Msg 701, Level 17, State 123 Line 1
I am running the database on a Dual core 2.7 GHz machine with 2GB of RAM.
Is there any way I can get this query to execute?
...
I need to JOIN a table when certain conditions are met and LEFT JOIN it when other conditions are met. Since I am in a MS Dynamic CRM with filters, I can't use UNION
SELECT stuff.stuffs
FROM MainTable
JOINS othertable
LEFT JOIN othertables
LEFT JOIN TableX as X1 ON (Conditions1.1 = X1.1
AND MainTable....