I have a table in SQL Server 2005 with hundreds of rows with HTML content. Some of the content has HTML like:
<span class=heading-2>Directions</span>
where "Directions" changes depending on page name.
I need to change all the <span class=heading-2> and </span> tags to <h2> and </h2> tags.
I wrote this query to do content changes in ...
I have attempted to make my first 3 tier application. In the process I have run into one problem I am yet to find an optimal solution for.
Basically all my objects use an IFillable interface which forces the implementation of a sub as follows
Public Sub Fill(ByVal Datareader As Data.IDataReader) Implements IFillable.Fill
This sub the...
Hi,
I have two tables, one table has rowguid column and other has auto incremented column but both tables dont have primary key or foreign key. I want to create third table that store the relationship between above two tables. can somebody give me the correct and easiest way to do that. i m new using sql server. please reply me
...
can anyone please tell me the right way to insert values in the rowguid column of the table? I m using sql server management studio
...
I know I've done this before years ago, but I can't remember the syntax, and I can't find it anywhere due to pulling up tons of help docs and articles about "bulk imports".
Here's what I want to do, but the syntax is not exactly right... please, someone who has done this before, help me out :)
INSERT INTO dbo.MyTable (ID, Name)
VALUES ...
I'm doing a INSERT INTO query in order to initialize a new table.
The primary key is RFQ_ID and Action_Time
How could add 1 milisecond to each Action_Time on new record in order to avoid "Violation of PRIMARY KEY constraint"
INSERT INTO QSW_RFQ_Log
(RFQ_ID, Action_Time, Quote_ID, Note)
SELECT
RFQ_ID
, GETDATE() AS Action_Time
, ...
I have a stored procedure on SQL Server 2005. It is pulling from a Table function, and has two joins. When the query is run using a load test it kills the CPU 100% across all 16 cores! I have determined that removing one of the joins makes the query run fine, but both taxes the CPU.
Select
SKey
From
dbo.tfnGetLatest(@ID) a
le...
Hi,
I want to get tree representation answer from my t-sql stored procedure. How can I do it ?
Does .NET have a predefined types for working with xml-answers from stored procedures ?
...
Hi all
I thought I'd be flexible this time around and let the users decide what contact information the wish to store in their database. In theory it would look as a single row containing, for instance; name, adress, zipcode, Category X, Listitems A.
Example
FieldType table defining the datatypes available to a user:
FieldTypeID, Fiel...
I have the following example in a SQL table
Cust Group Sales
A 1 15
A 1 10
A 1 5
A 2 15
A 2 10
A 2 5
B 1 15
B 1 10
B 1 5
B 2 15
B 2 10
B 2 5
What I would like to show is the top 2 products per customer, per group sorted descending by Sales i.e.
Cust Group Sales
A 1 15
A 1 ...
Trying the following code. But getting 'The argument 1 of the xml data type method "modify" must be a string literal' error. searched alot but cant find any solution for this problem
SET @Path = '/@ParentNodeName/@NodeName/child::*'
SET @x.modify('insert attribute status {sql:variable("@status")}
as first into (' + @Pat...
Perhaps a dumb question, but consider these 2 tables :
T1
Store Year
01 2009
02 2009
03 2009
01 2010
02 2010
03 2010
T2
Store
02
Why is this INNER JOIN giving me the results I want (filtering the [year] in the ON clause) :
select t1.*
from t1
inner join t2
on t1.store = t2.store
and t1.[year] = '2009'...
Based on a previous question and with a lot of help from Damir Sudarevic (thanks) I have the following sql code which works great but is very slow. Can anyone suggest how I can speed this up and optimise for speed.
I am now using SQL Server Express 2008 (not 2005 as per my original question).
What this code does is retrieves paramet...
I have a date column where the date is displayed in the format 2009-11-18 10:55:28.370.
I just want to get the date (not time) out of that value. How do I do that?
...
Hi Guys,
Ok I have a data table containing duplicate Reciept numbers and a
transaction value for each record, I need to simply list the total for
each unique Reciept number, this is obviously a simple problem but I
am missing something.
Any help is much appriciated
SELECT Gf_Receipt_number AS Reciept,
SUM (Gf_Amount) AS Total
...
Guys,
I have a set of tables (say Account, Customer) in a schema (say dbo) and I have some other tables (say Order, OrderItem) in another schema (say inventory). There's a relationship between the Order table and the Customer table. I want to delete all the relationships between the tables in the first schema (dbo) and the tables in t...
I'm trying to insert the word "Null" (literally) in to a parameter for a stored procedure. For some reason SqlServer seems to think I mean NULL and not "Null". If I do a check for
IF @LastName IS NULL // Test: Do stuff
Then it bypasses that because the parameter isn't null.
But when I do:
INSERT INTO Person (<params>) VALUES (<stuff...
I have two sets of data (locations) in separate tables and I need to compare if they match or not. I have a UDF which performs a calculation based upon 5 values from each table.
How do I perform a select with a join using this udf?
my udf is basically defined by....
ALTER FUNCTION [dbo].[MatchRanking]
(
@Latitude FLOAT
...
I have run this query successfully multiple times no more than a couple of weeks ago. I have not made a single change to it. It seems unlikely that the back-end data would have changed enough to produce no results. What else could contribute to this?
...
I have a select statement and in a couple of the fields, I want to check if an entry for the record exists in another table and if it does, output 1 value and if it doesn't, provide another value.
What would be the best way to do it? When would you use a stored procedure and when would you use a UDF?
...