|
I got the solution for above issue
Issue is we have a folder name called Reports in application and also we have same name virtual directory in IIS
|
|
|
|
|
Hi,
DECLARE @Location_ID INT<br />
SELECT @Location_ID = 3<br />
<br />
;WITH ret AS(<br />
SELECT * FROM Locations<br />
WHERE Location_ID = @Location_ID <br />
UNION ALL<br />
SELECT t.*<br />
FROM Locations t INNER JOIN<br />
ret r ON t.Parent_ID = r.Location_ID<br />
)<br />
SELECT * FROM ret
here is my query, am getting error:Incorrect syntax near the keyword 'WITH'
help me to fix this problem friends
icanmakeiteasy
|
|
|
|
|
|
Michel Godfroid wrote: Semi-colons do not display in Braille?
There's nothing wrong with the semi-colon. What point were you trying to make, or were you just trying to be smart?
|
|
|
|
|
You're right, I stand corrected; sincere apologies.
The line breaks and absence of indentation made me think the first couple of lines belonged to the same statement.
|
|
|
|
|
There is nothing wrong with this query unless you are using SQL 2000 or earlier!
Wout Louwers
|
|
|
|
|
srry, for the late reply
am using sql server 2000,
plz help me to achieve this in sql server 2000
icanmakeiteasy
|
|
|
|
|
Is it possible to specify multiple text data filters in sql profiler 2005? IE: if you go to the trace properties and then column filters. I have a textData - not equal filter specified, but I'd like to add a couple other text values to ignore. Is this possible?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
hi iam using sql server 2000
iam having two tables with same fields
my first tableA contains the fields
Orderid int primary key identity(automatically increment)
productname nvarchar
price nvarchar
quantity nvarchar
total nvarchar
my second tableB contains the fields
Orderid int (no primary key)
productname nvarchar
price nvarchar
quantity nvarchar
total nvarchar
from asp.net iam entering multiple values at a time in tableA, at the same time i want to insert into tableB
can you give the querry which helps me
|
|
|
|
|
A stored procedure that performs the operation should do it. Or you could put a trigger on TableA if you liked.
I'd question your datatypes for fields like price, quantity, total etc. Shouldn't be using strings for what looks like numeric information
CREATE PROCEDURE CreateOrderDetails
(
@ProductName NVARCHAR(50),
@Price NVARCHAR(10),
@Quantity NVARCHAR(10),
@Total NVARCHAR(10)
)
AS
SET NOCOUNT ON
DECLARE @MyRecordId INT
INSERT INTO
TableA (productname, price, quantity, total)
VALUES
(@ProductName, @Price, @Quantity, @Total)
--Get the ID of the record we just created
SET @MyRecordId = SCOPE_IDENTITY()
INSERT INTO
TableB (Orderid, productname, price, quantity, total)
SELECT
Orderid, productname, price, quantity, total
FROM
TableA
WHERE
Orderid = @MyRecordId
RETURN @@ERROR
SET NOCOUNT OFF
|
|
|
|
|
I'm curious, what is the logic for creating such a data structure, why are you storing data twice.
And yes you really should change you data types away from the default, it will cause you no end of problems.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hey by using trigger u can do this. Trigger can used to implemnt business rules
|
|
|
|
|
I wouldn't do this since triggers can slow down the DB. Stored procedure or sep. calls is better. If it needs to be all or nothing and assuming the inserts are single row, wrap in a transaction.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
You can make your stored procedure save same data in both the tables (two insert statements). BTW, why are you doing this? Don't you think it is weird?
|
|
|
|
|
Hi all,
This is how im getting columns from 3 tables....
select projectID=projects.projectid,projectname,
[image],country,county,ClientCompany,city,ConstructionCompletionDate_dt,
OverallBuildingSize_uts from projects, schedule,BuildingSiteStatics
where projects.projectid=schedule.projectid and projects.projectid=BuildingSiteStatics.projectid
I have searched from 2 tables using following query
select a.*,b.ConstructionCompletionDate_dt from projects a join
schedule b on a.projectid=b.projectid where projectname like '%%' or
country like '' or clientcompany like '%%' or
ConstructionCompletionDate_dt like '%%'
Now i need to search columns from 5 tables How can i do it....
|
|
|
|
|
test-09 wrote: Now i need to search columns from 5 tables How can i do it....
Obviously, you need to join the remaining tables with your existing ones and filter the data from the corresponding columns.
When you fail to plan, you are planning to fail.
|
|
|
|
|
As said, jion all 5 tables.
If you expect to reuse the 5 table join in other queries I would create a view, makes life much simpler.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
select projectID=projects.projectid,projectname,
[image],country,county,ClientCompany,city,ConstructionCompletionDate_dt,
OverallBuildingSize_uts from projects, schedule,BuildingSiteStatics
where projects.projectid=schedule.projectid and projects.projectid=BuildingSiteStatics.projectid
using above query how can i join 5 tables..
|
|
|
|
|
This query uses what I call Oracle joins where the links are in the where clause, never to be seen in any database I own. Use the propert join methods. Here is a sample from a view I have
FROM dbo.FactConsoTB AS F
INNER JOIN dbo.Branch AS B ON F.BranchID = B.BranchID
INNER JOIN dbo.lnkAccountProduct AS L ON F.APLinkID = L.APLinkID
INNER JOIN dbo.Account AS A ON L.AccountID = A.AccountID
INNER JOIN dbo.Product AS P ON L.ProductID = P.ProductID
INNER JOIN dbo.Currency AS C ON F.CurrencyID = C.CurrencyID
INNER JOIN dbo.Currency AS BC ON F.BaseCurrencyID = BC.CurrencyID
INNER JOIN dbo.ProductCategory ON P.ProductCategoryID = dbo.ProductCategory.ProductCategoryID
test-09 wrote: select projectID=projects.projectid
Why are you useing this.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
using view i tried this but im getting error
"Ambiguous column name 'ConstructionCompletionDate_dt'"
what wrong im doing....
SELECT dbo.Projects.ProjectID, dbo.Projects.ProjectName,
dbo.Projects.City, dbo.Projects.County, dbo.Projects.Country,
dbo.Projects.ClientCompany,
dbo.BuildingSiteStatics.OverallBuildingSize_uts,
dbo.Schedule.ConstructionCompletionDate_dt,
dbo.OverallDevelopment.TotalNumberDwellings
FROM dbo.Projects INNER JOIN
dbo.BuildingSiteStatics ON dbo.Projects.ProjectID = dbo.BuildingSiteStatics.ProjectID INNER JOIN
dbo.OverallDevelopment ON dbo.Projects.ProjectID
= dbo.OverallDevelopment.ProjectID INNER JOIN
dbo.Schedule ON dbo.Projects.ProjectID = dbo.Schedule.ProjectID where projectname like '%%' or country like ''
or clientcompany like '%%' or ConstructionCompletionDate_dt like '%%'
|
|
|
|
|
Prefix the column name with the tablename or the alias.
Also try Google and BOL, the response time is generally quicker and gentler.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
test-09 wrote: Now i need to search columns from 5 tables How can i do it....
One alternative would be to build some views, consisting of a tablename, columnname and a varchar representing the value. Create a union of those views to search all columns with a single select-statement and the LIKE operator.
What database are you using? If you're on Sql Express, have you considered using the Full Text Search[^] component?
I are Troll
|
|
|
|
|
I'm looking for a way to concatenate all the fields in a result set to one value. If I know the names of the fields, it is fairly easy:
SELECT Field1 + Field2 + Field3 FROM MyTable
although it is a bit more tricky if one or more of the fields are numeric in which case the following would do:
SELECT CAST(Field1 AS VARCHAR) + CAST(Field2 AS VARCHAR) + CAST(Field3 AS VARCHAR) FROM MyTable
The above snippets would return a long string (a concatenation of all the fields) for each row in the table.
But what if I don't know the names, number of and types of fields in the table? Is there a way to still accomplish the above?
Thanks in advance.
|
|
|
|
|
You would have to mess around with sys.columns sys.types to determine the datatype of the columns dynamically. Of course you would have to know the table and column name before trying to get the datatype.
OR
Are you constrained by using TSQL ?
If you write a .NET application and put the results into a Datatable, you could then find the datatype by using something like: Datatable.Columns.GetType()
Good luck
|
|
|
|
|
Thanks,
I was hoping to be able to do it using SQL only but I eventually decided to do it from inside a C# app which does make it a lot simpler.
|
|
|
|