I know storing multiple values in a column. Not a good idea.
It violates first normal form --- which states NO multi valued attributes. Normalize period...
I am using SQL Server 2005
I have a table that require to store lower limit and uppper limit for a measurement, think of it as a minimum and maximum speed limit... only problem is ...
There are several SQL split functions, from loop driven, to using xml commands, and even using a numbers table. I haven't found one that supports text qualifiers.
Using the example string below, I would like to split on ",", but not when it appears between double or single quotes.
Example data:
[email protected], "Sally \"Heat\" Jo...
Hi All,
I'm new to this board. I have been driving myself crazy trying to find the answer to my problem.
I created some TSQL code that executes some dynamic SQL in a cursor within a stored proc. The cursor fetches some data from table x, builds a query based data retrieved in table x, runs the query, and returns data. Works like a charm...
Hey Now,
Is there a SQL Server Management studio add-on/plug-in that will enhance the tab switching dialog box when Ctrl+Tab is used to switch tabs to provide a thumbnail image of the tab?
When we use Ctrl+Tab to switch tabs we see the list of tabs open. When we switch tabs in Visual Studio we get a small thumb nail preview screen of t...
How can i pass a string delimited by space or comma to stored procedure and filter result?
I'm trying to do something like -
Parameter Value
--------------------------
@keywords key1 key2 key3
Then is stored procedure i want to first
find all records with first or last
name like key1
filter step 1 with first or last
name...
SET ANSI_NULLS OFF seems to give different results in TSQL depending on whether you're comparing a field from a table or a value. Can anyone help me understand why the last 2 of my queries give no results? I'm not looking for a solution, just an explanation.
select 1 as 'Col' into #a
select NULL as 'Col' into #b
--This query gives resu...
I have two tables : Product and ProductRateDetail. The parent table is Product. I have duplicate records in the product table which need to be unique. There are entries in the ProductRateDetail table which correspond to duplicate records in the product table.
Somehow I need to update the ProductRateDetail table to match the original (...
Is it possible to parse JSON in TSQL?
I dont mean to create a JSON string, i mean to parse a json string passed in as a parameter.
...
Guys, I have a table called tblNames and one of my fields in this table is called 'UpFileName'. Is it possible to create an insert trigger that would automatically replace all '%20' in the UpFileName field to underscores '_'?
I'm using SQL Server 2005.
...
Using MS SQL 2005,
Table 1
ID | T1Value | T2ID | GroupID
----------------------------------
1 | a | 10 | 1
2 | b | 11 | 1
3 | c | 12 | 1
4 | a | 22 | 2
Table 2
ID | T2Value
----------------
10 | H
11 | J
12 | K
22 | H
I want to clone the dat...
I have data in an nvarchar field with data in ascii format: "Zard Frères Guesta"
How do I convert it to a readable(unicode) format in t-sql?
...
I'd like to indicate to SQL Server 2005, in my BEGIN CATCH...END CATCH block that the error is "handled"... That is, clear the error.
Is that possible? Consider this:
begin transaction
begin try
begin transaction
select cast('X' as bit)
commit transaction
end try
begin catch rollback transaction
select...
I have a table that contains some data given below. It uses a tree like structure
i.e.
Department
SubD1, SubD2 .....
PreSubD1, PreSubD1... PreSubD2, PreSubD2...
pk_map_id preferences ImmediateParent Department_Id
-------------------- ---------------...
On my website, there exists a group of 'power users' who are fantastic and adding lots of content on to my site.
However, their prolific activities has led to their profile pages slowing down a lot. For 95% of the other users, the SPROC that is returning the data is very quick. It's only for these group of power users, the very same SP...
Hi guys,
I'm looking for a way to do this ...
SELECT FirstName, LastName, Split(AddressBlock, ' ', 1), Split(AddressBlock, ' ', 2), PostCode
FROM Contacts
The arguments I want to pass are ...
The address
The separator (current situation requires 2 spaces but this might be a comma or a space followed by a comma) or something els...
Does all the columns in select statement gets selected one after another as listed?
Declare @X, @Y
SELECT
@X = ColumnA*.25 + ColumnB*2.5,
@Y = ColumnA*.5 + ColumnC*1.33,
TOTAL = @X + @Y
FROM SomeTable
Is the above query safe to use? Will total always be selected after @X and @Y are calculated?
...
Create table testxml
(xmldata xml)
declare @var nvarchar(max)
set @var = N'الوفاق الوطني المخ'
insert into testxml
select @var
After inserting , i am getting data from table like
select * from testxml
---------------------
????????
Can you provide me the solution?
...
I am comparing two dates and trying to determine the max of the two dates. A null date would be considered less than a valid date. I am using the following case statement, which works - but feels very inefficient and clunky. Is there a better way?
update @TEMP_EARNED
set nextearn = case when lastoccurrence is null and lastearned is null...
I want to do something like this:
declare @temp as varchar
set @temp='Measure'
if(@temp == 'Measure')
Select Measure from Measuretable
else
Select OtherMeasure from Measuretable
...
I have a Winform that has fields need to be filled by a user. All the fields doesn't belong to one table, the data will go to Customer table and CustomerPhone table, so i decided to do multiple inserts. I will insert appropriate data to CustomerPhone first then Insert the rest data to Customer table.
Is it possible to Join an Insert OR ...