I have a data entry and editing form and in every data entry or update event, I have to send an email to a dynamic list of recipients. I have been sending the email as soon as the user clicks the save or edit buttons but am thinking of first saving the data to the database, and then sending the email later. I want to do this partly to im...
How to set unique key constraint in SQL Server 2005? Not through script or query.
...
What is the difference between Primary key And unique Key constraint?
What's the use of it??
...
Is it possible set more than one primary key for a table?
If it is possible as composite key - so how it can be used with application??
ADVANTAGES .?
...
I have Two SQL Query Both Return
select round(convert(float,'24367.723'),2)
Result:24367.72
Second:
select convert(varchar(20),round(convert(float,'24367.723'),2))
Result:24367.7
Why the Second Query Return exclude the last digit after converting to varchar
Thanks in Advance
...
I want to use a table valued function and call it from within multiple stored procedures rather than repeat the same query across all the stored procedures, but for compatibility with a legacy VB6/UltraGrid app I need to preserve the foreign key references from the original tables.
Within the table valued function I can specify a PRIMAR...
We are transitioning from SQL Server 2005 to 2008 and suddenly our Execute As User statements aren't working. Did something change between these 2 releases?
...
is there a canonical way to partition a table by referenced data to another table?
for example
timetable
id
datetime
bigtable
id
timetable_id -- foreign key
.. other data ..
i want to partition bigtable by the datetime in timetable. thankx.
...
I have this query:
select * from table where column like '%firstword[something]secondword[something]thirdword%'
What do I replace [something] with to match an unknown number of spaces?
Edited to add: % will not work as it matches any character, not just spaces.
...
Hey all, i am trying to create a report to show how much is spent per HRCode. This is my SQL Query so far:
SELECT *
FROM tblWO as WO,
tblWOD as WOD,
tblWA as WA
WHERE WOD.OrderID = WO.ID
AND WA.HRCode = WO.AdministratorCode
AND WO.OrderDate BETWEEN '2010-01-01' AND '2010-08-31'
AND Approved = '1'
ORDER B...
In SqlServer 2005 I have a table with a TimeOfDay field that is a varchar(5). I want to limit the field value to valid times only (13:40,2:20). This is what I have so far
ALTER TABLE tbl ADD CONSTRAINT ck
CHECK (TimeOfDay like '[1-2][0-9]:[0-9][0-9]' )
I want the constraint to allow the first digit to be optional, but not having much ...
I have a SQL 2005 instance that runs a job that uses a Powershell script to rename the current SQL TX Log backup file by appending "-PrevDay" to it, (subsequently deleting the backup already named "XXX-PrevDay.bak" if it exists), and then run a full backup of the DB and a TX Log backup, if the DB is not in Simple mode.
SQL Job kicks off...
My SQL Server view
SELECT
geo.HyperLinks.CatID, geo.Tags.Tag, geo.HyperLinks.HyperLinksID
FROM
geo.HyperLinks LEFT OUTER JOIN
geo.Tags INNER JOIN
geo.TagsList ON geo.Tags.TagID = geo.TagsList.TagID ON geo.HyperLinks.HyperLinksID = geo.TagsList.HyperLinksID WHERE HyperLinksID = 1
returns these...
HyperLinksID...
I have been trying to create a stored procedure that uses dynamic SQL to assemble a bcp command to export data from a parameterized stored procedure to a csv file.
Was originally getting the host data file access issue that I think was filesystem permissions.
Now I consistantly get the fillowing error when I run the proc:
SQLState = S...
I have transformed an XML file
See this question for a complete description
What I want to do know is take this xml task and have it preformed in a For Each Loop. I want all xml files in a specific directory to be transformed and the resulting file to be moved to seperate directory.
It's not working. I'm getting the following error m...
I have self join table. This table is being used to join up to 4 level, i.e.;
Region -> Country -> County -> Town
How can I get Parent of Parent of Town. To do this up to two level this is the query
SELECT t.ShortName AS Town,
(SELECT c.ShortName FROM Locations c
WHERE c.LocationId = t.ParentId) AS County
FROM ...
Hey all, this is my query string here:
SELECT SUM(Total) as Total, AdministratorCode, SUM(WOD.Quantity) as thePass
FROM tblWO as WO,
tblWOD as WOD
WHERE WOD.OrderID = WO.ID
AND WO.OrderDate BETWEEN '2010-01-01' AND '2010-08-31'
AND Approved = '1'
ORDER BY WO.AdministratorCode
But i keep getting the error:
The ...
My app fails at this line of code:
Dim objConnection As New SqlConnection(Application("ConnString"))
My connection string is:
"Server=testAITSQL;Database=SSCommerce;UID=PlanoWebApp;PWD=XXXXXXXX;"
I googled this problem and the solution for it was having a malformed connection string where the "provider" was being specified when it ...
Imagine you have 2 applications Application A and Application B.
Basically I would like to insert records that exist in Application A into Application B.
Sql Server Reporting Server is available on Application A
And I was wondering if it is possible to build a report that gathers the record that I need and then publish it as a web serv...
How do you specify field lengths with the Bulk Insert command?
Example: If I had a table named c:\Temp\TableA.txt and it had:
123ABC
456DEF
And I had a table such as:
use tempdb
CREATE TABLE TABLEA(
Field1 char(3),
Field2 char(3)
)
BULK INSERT TableA FROM 'C:\Temp\TableA.txt'
SELECT * FROM TableA
Then how would I specify the lengt...