Can I just use CROSS APPLY like below?
SELECT ProductCode
,OrderCode
,OrderDescription
FROM @ProductCodes PC
CROSS APPLY @OrderData OD
ORDER BY ProductCode
In order to improve readability and performance, can I simplify the query below to a select query?
DECLARE @ProductCodes TABLE(ProductCode nvarchar(3), IsProcessed bit DEFAULT 0)
INSERT INTO @ProductCodes(ProductCode) VALUES('ABC')
INSERT INTO @ProductCodes(ProductCode) VALUES('DEF')
INSERT...
I used this:
SELECT EmailFollowupID
FROM tblEmailFollowup
CROSS APPLY OptionalParameters.nodes('//Parameter') R(ref)
WHERE ref.value('UserType[1]', 'nvarchar(50)') = 'DonorManager'
In your example
DECLARE @tblEmailFollowup TABLE
(
EmailFollowupID int IDENTITY(1,1)
,OptionalParameters xml
)
DECLARE @Parameter XML
SET @Parameter = '<Parameter><UserType>DonorManager</UserType></Parameter>'
INSERT INTO @tblEmailFollowup(OptionalParameters) Values (@Parameter)
SET...
I'm using SQL Server 2008 R2.
I have a table with a xml data type column. I'm trying to query one of the elements from the column's value, but getting the following error:
Msg 2389, Level 16, State 1, Line 12
XQuery [tblEmailFollowup.OptionalParameters.value()]: 'value()' requires a singleton...
Below is the structure of my web application.
- Site.Master
- MappingTable.Master
- DataPage.aspx (Content Page)
From Site.Master, I need to disable a button on the DataPage.aspx. How would I do that?
Thanks!
I'm using VS2012. I'm trying to follow an exercise from a book.
Here is the code for my custom server control:
namespace ServerControl
{
[ToolboxData("<{0}:menucustomcontrol runat=\"server\"></{0}:menucustomcontrol>")]
public class MenuCustomControl : Control
{
protected...
I have a table with the table name, column name, column values and whether the column values should be included or excluded.
This table is used to filter what data should be loaded. Here is an example
TableName ColumnName ColumnValue Include/Exclude
tblProduct ProductID 1 Exclude
tblProduct...
I have a table structure (tblmapping) like the following:
TableName ColumnName ColumnValue
Product ProductID 1
Product ProductID 2
Product ProductName Keyboard
Product ProductName Mouse
I want to convert from column based data to row based data. I tried the following query, but...
If I pass a date and the days that should be subtracted I need to find the next weekday. Here is what I have:
static DateTime GetFileDate(DateTime BusDate, int DayLag)
{
DateTime FileDate;
FileDate = DateTime.Today;
switch...
Thanks for your help George. I just fount out a twist on the requirement.
The fall DST date is 11/3/2013 and lets say the current date is 11/4/2013. So if I do
Select DateDiff(Hour, GetUTCDate(), GetDate())
It should give me -5. Now the date that I need to convert from GMT to EST is...
I need to write a function that converts a time from GMT to EST taking daylight savings time into consideration.
On a high level I was thinking of doing the following:
a) a table that holds the daylight saving dates for this year and upcoming years. does anyone know a website that has these...
One of our engineers is having a problem installing SQL Server 2008 R2 on a Windows 2003 R2 machine. When we click on setup.exe the installation wizard doesn't show up. Is this because Sql Server 2008 R2 cannot be installed on a Windows 2003 R2 machine? Thanks!
Thanks George. Sorry I'm a still little confused on how views work behind the scenes. Is the view (query) stored with the execution plan? And therfore the performance save?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.