|
Thanks for the reply
Its a good start, but it looks like you are only taking into account the first character and in case it is a pecial symbol you take the second, it wont work if you have values like these:
DECLARE @Table AS Table( ID Int, [Name] nVarChar(50))
INSERT INTO @Table SELECT 1, '"The morning..."'
INSERT INTO @Table SELECT 2, 'The long and...'
INSERT INTO @Table SELECT 3, '-ABC of Math'
INSERT INTO @Table SELECT 4, '*Something Else'
SELECT * FROM @Table
ORDER BY (SELECT CASE WHEN (UNICODE(SUBSTRING(Name,1,1))< 123)
THEN UNICODE(SUBSTRING(Name, 2,1))
ELSE Name End) ASC
Notice how
"The morning..."
appears before
The Long and...
Thanks again for your example
Alexei Rodriguez
|
|
|
|
|
Yes, I have tried quite a few things. You will have to parse the data in the client and perform your sorting there. This is the correct way. The database is for data and not particularly interested in the formatting.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
AlexeiXX3 wrote: Notice that the title may o may not have or may have more than 1 special character at the beggining
The best I can think of is a UDF that uses the REPLACE function to strip those characters. You could add this on a separate view on the table, including the column only when needed- as it would be a very expensive operation (looping all characters for each record).
It might be better (performance-wise) to store a redundant version of the Title, without any special characters.
I are Troll
|
|
|
|
|
hy,
I have got data in form of pdf file(in table format) i want to extract data and dump it in database
Is there any way in which i can read data from pdf file.
|
|
|
|
|
Hi!
I need to move a database from one server to another.
So I have the server 'S1', the database 'DB1' which is located on the server 'S1' and the server 'S2'. I use MS SQL Server 2005 Express.
I carried out following actions:
1) executed stored procedure sp_detach_db 'DB1' on server 'S1'
2) copied files DB1.mdf and DB1Log.ldf from 'S1' to 'S2'
3) tried to execute the query on the server 'S2':
CREATE DATABASE DB1
ON (NAME = DB1_data, FILENAME = 'file_path\DB1.mdf')
LOG ON (NAME = DB1_log, FILENAME = 'file_path\DB1Log.ldf')
FOR ATTACH
and recieved the error: "Unable to open the physical file "file_path\DB1.mdf Operating system error 5".
When I executed the same query on 'S1' to attach DB1 again it was finished successfully...
Tell me please what is the source of the error? and how do I solve my problem.
|
|
|
|
|
Problem is solved by adding full access permisions for 'MSSQLUser' user group to the file_path directory.
|
|
|
|
|
Dears,
I have problem in geting record from SQL SERVER 2000
I am using stored procedure with (READPAST) in query
Ex select top 100 * From T_table with (READPAST)
and im using lock for some record
i want to get unlocked records using READPAST
and get error in .net
Message: You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels.
Yes. CreatiVity withOuT limiTs
|
|
|
|
|
I don't no where to post this question please help me
I am facing this problem from last two days
while opening report from my website i am getting following issue this was working fine on our test server
but in client machine we are getting this issue
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
i am using vs2005 and sql2005 reporting services
i checked on client machine report is opening from report manager
and anonymous user chek box is checked and windows auth check box checked
we have one user reportadmin he has rights browser also and this user also have rights in reportserver db with resexe role .
this id my cod
protected void Page_Load(object sender, EventArgs e)
{
BreadCrumbs.MenuItemID = ModuleID;
HdnParameters.Value = Convert.ToString(Session["UserID"]) + "-" + Convert.ToString(Session["ProviderID"]) + "-" + ViewDataAccessType;
RVReferralListing.BorderWidth = 0;
if (!this.IsPostBack)
{
int referralID = 0;
if (Request.QueryString["ReferralID"] != null)
{
referralID = Convert.ToInt32(Request.QueryString["ReferralID"]);
FillSubReport(referralID);
}
if (referralID == 0)
{
PnlSearchBasedControls.Attributes.Add("style", "display:''");
divMainReport.Attributes.Add("style", "display:''");
divSubReport.Attributes.Add("style", "display:none");
}
else
{
PnlSearchBasedControls.Attributes.Add("style", "display:none");
divMainReport.Attributes.Add("style", "display:none");
divSubReport.Attributes.Add("style", "display:''");
}
Session["ClientAccessData"] = Convert.ToString(Session["UserID"]) + "-" + Convert.ToString(Session["ProviderID"]) + "-" + ViewDataAccessType;
}
}
private void FillSubReport(int referralID)
{
RVReferralSubReport.Visible = true;
RVReferralSubReport.BorderWidth = 2;
Uri ur = new Uri(Convert.ToString(ConfigurationManager.AppSettings["ReportServerUri"]));
RVReferralSubReport.ServerReport.ReportPath = Convert.ToString(ConfigurationManager.AppSettings["ReportPath"]) + "/ChldReferralServicesReport";
RVReferralSubReport.ServerReport.ReportServerUrl = ur;
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new ReportParameter("ReferralID", referralID.ToString(), false));
RVReferralSubReport.ServerReport.SetParameters(paramList);
}
protected void btnViewReport_OnClick(object sender, EventArgs e)
{
string clientID = "";
string stateID = "";
if (txtClientName.Text.Trim() != "")
{
if (CheckIfExists_ClientName(txtClientName.Text) == "Empty")
{
hdnClientIDTyped.Value = "";
lblWarning.Text = "Please select valid client name from the list.";
ScriptManager.GetCurrent(Page).SetFocus(txtClientName);
txtClientName.Text = "";
MPEWarning.Show();
return;
}
else
{
hdnClientIDTyped.Value = CheckIfExists_ClientName(txtClientName.Text);
}
clientID = hdnClient.Value.ToString() != "" ? hdnClient.Value : hdnClientIDTyped.Value;
}
if (txtState.Text.Trim() != "")
{
if (CheckIfExists_State(txtState.Text) == "StateError")
{
hdnClientIDTyped.Value = "";
lblWarning.Text = "Please select valid state from the list.";
ScriptManager.GetCurrent(Page).SetFocus(txtState);
txtState.Text = "";
MPEWarning.Show();
return;
}
else
{
hdnStateTypedID.Value = CheckIfExists_State(txtState.Text);
}
stateID = hdnState.Value.ToString() != "" ? hdnState.Value : hdnStateTypedID.Value;
}
FillReport(clientID != "" ? clientID : null, stateID != "" ? stateID : null, txtZipCode.Text != "" ? txtZipCode.Text : null);
}
private void FillReport(string clientID, string stateID, string zipCode)
{
RVReferralListing.Visible = true;
RVReferralListing.BorderWidth = 2;
Uri ur = new Uri(Convert.ToString(ConfigurationManager.AppSettings["ReportServerUri"]));
RVReferralListing.ServerReport.ReportPath = Convert.ToString(ConfigurationManager.AppSettings["ReportPath"]) + "/PG_ReferralReport";
RVReferralListing.ServerReport.ReportServerUrl = ur;
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new ReportParameter("ClientID", clientID, false));
paramList.Add(new ReportParameter("State", stateID, false));
paramList.Add(new ReportParameter("Zipcode", zipCode, false));
paramList.Add(new ReportParameter("ZipCode_1", zipCode, false));
paramList.Add(new ReportParameter("UserID", Convert.ToString(Session["UserID"]), false));
paramList.Add(new ReportParameter("AllowView", Convert.ToInt32(AllowView).ToString(), false));
paramList.Add(new ReportParameter("AllowEdit", Convert.ToInt32(AllowEdit).ToString(), false));
paramList.Add(new ReportParameter("EditDataAccessType", EditDataAccessType, false));
paramList.Add(new ReportParameter("ViewDataAccessType", ViewDataAccessType, false));
RVReferralListing.ServerReport.SetParameters(paramList);
//RVReferralListing.Reset();
hdnClient.Value = "";
hdnState.Value = "";
}
|
|
|
|
|
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
|
|
|
|
|