I have the following 3 tables
Teams (TeamID int, TeamName varchar(200)) - TeamID is identity col
Users (UserID int, Username varchar(200)) - UserID is identity col
UsersTeams (ID int, UserID int, TeamID int) - Table has FK references to the 2 tables above
The table UsersTeams is used to keep a record of all teams a user is a member of...
UPDATE a
SET CountOfAA=dt.CountOf
FROM @MediaResurce a
INNER JOIN (SELECT
aa.Sku,ISNULL(COUNT(bb.sku),0) AS CountOf
FROM @MediaResurce aa
LEFT OUTER JOIN @MediaResurce_Pics bb
ON aa.sku=bb.sku
...
Hi All,
I have a scenario where I want to get the distinct nodes from XML.
So if I have this XML:
<person>
<age>
<year value="2010"/>
<month value="10"/>
<day value="21"/>
</age>
<age>
<year value="2011"/>
<month value="11"/>
<day value="4"/>
</age>
</person>
How could I retrieve in the results:
person
age
y...
This stored procedure doesn't work. I've checked the SQL and it returns the correct value when parsed directly to the DB. It's really strange! It just returns 0 rows.
What could be wrong?
ALTER PROCEDURE dbo.GetSaltOfUser
(
@eMail nvarchar
)
AS
DECLARE @result nvarchar
/* SET NOCOUNT ON */
BEGIN
SELECT @result = salt
FROM ...
Hi,
I have 270 million records in a table. Currently I have a non clustered index in it on a date column. 99% of time I use rows with date > 1/1/2008..that means 140 million out of it.
I am using SQL server 2008.In this situation will it be beneficial to use filtered index other than normal non-clustered index ?
Also if I use "date" da...
If I have a filtered index, and if I use data beyond that range, what kind of performance hit would be incurred?
...
I am using SQL EXPRESS EDITION 2005 and Created mdf data file using vb.net 2008. now i want to use this datafile in lan. i modified connection string
"Data Source=.\SQLEXPRESS;AttachDbFilename=\Server\Data\Data1.mdf;Integrated Security=True;User Instance=True;Connect Timeout=60"
it is showing security info error i want to use single ...
Hi All,
I have a table of important annual dates. I'd like to display them in a gridview with the date that's coming up to be on top row relative to today's date. For instance, if my birthday is the next thing coming up that should be at the top row of the gridview.
What's the best way to do this?
Thanks,
rod.
...
I have to display the Rank of a user for which I plan to use the Rank() function in SQL Server. The Sql query to get the rank is as follows
select a.user_id, RANK() OVER (ORDER BY (a.quant_points) DESC) AS QRANK,
RANK() OVER (ORDER BY (a.verbal_points) DESC) AS VRANK,
RANK() OVER (ORDER BY (a.dilr_points) DESC) AS DRANK,
RAN...
Hello:
I want to preview a report in a Delphi 7 program that connects to a SQL database. The database can use SQL or Windows Authentication.
If SQL Authentication my program do:
MyReportComponent.Connect.Server:=myServer;
MyReportComponent.Connect.UserId:=myUserId;
MyReportComponent.Connect.Password:=myPassword;
MyReportComponent.Conn...
I want to create a procedure that will
A) check to see if TicketNumberInput is in table Tix_number.TicketNumber.
B) if it does exisist, update the record to set UID to @uid and Set the Claimdate to GetDate()
AND ...
C) INSERT A RECORD INTO ANOTHER TABLE (TRANSACTION LOG TABLE)
If the record does exist, simply add a record to the tr...
in c# what is the difference between both.
...
I did red-read on this and could not clearly understand...
Having (for the purpose of shortening this question)
DECLARE @temp VARCHAR(4001);
--update: 4001 is for example only to avoid varchar(MAX) discussions
-- I am aware about 8000
SET @temp = 'a';
does SQL Server reserve 4001 bytes for @temp which (the rest 4000 from 40...
I am supposed to remove the following from the address field.
Replace all words named as 'Flat' to empty space, also remove the number that comes along with it.
eg. I have word called as 'Flat 234 5th Street'.
It should be replaced as 5th Street.
I gave the query as
select
ltrim(rtrim( substring ('Flat 123 5th Street', cha...
I'm trying to write a Stored Procedure which'll get a string, hash it with SHA1 and then return the hash. I can't seem to make it return @hashedString. I'll admit I'm a total beginner with T-SQL.
I'm writing the T-SQL directly in the db.
This is what I've gotten up to now:
ALTER PROCEDURE dbo.ConvertToHash
(
@stringToHash nvarcha...
Hi,
I am planning to create a scheduler like application using Jquery FullCalendar plugin.
Searched a bit, but there are examples using only asp.net mvc.
Is there a good tutorial for creating scheduler using asp.net web forms plus using sql server for storing events?
...
I need to fetch and show data on a webpage whose number of records may vary based on filters from around 500 records to 1 million records.
Will caching be of any use here as I think million record in memory is not a good thought. SqldataReader?
Paging is a must to implement of course. Showing 1 million records is a worst case scenario(...
I have used to read that varchar (char) is used for storing ASCII characters with 1 bute per character while nvarchar (varchar) uses UNICODE with 2 bytes.
But which ASCII? In SSMS 2008 R2
DECLARE @temp VARCHAR(3); --CHAR(3)
SET @temp = 'ЮЯç'; --cyryllic + portuguese-specific letters
select @temp,datalength(@temp)
-- results in
--...
I was trying to find a tool to increase performance in the reports of our application and I heard about OLAP + Reporting Services which is described as an excellent combination to do this work. Anyway I didn't find the way to keep the OLAP cube up-to-date since the data in the original DB can change. (It's a transactional application and...
In mySql Workbench there's a possibility to "sync" the model with the DB and vice versa. Is there a function like this in EF? I've added som entities and I'd like it to get reflected in the DB. Do I really have to regenerate the entire DB and loose data?
Thanks
...