|
|
Karthik_J, Coimbatore wrote: Microsoft SQL Server 2012 introduces 14 new built-in functions.
And you posted this to demonstrate that you can read documentation maybe?
|
|
|
|
|
I am using an Access 2000 database file. When parsing user input that has SQL reserved characters, I put [] around any reserved characters I find. This works fine, except when dealing with %s.
I have a table named "Foo", with two rows:
Type as text, SubType as text, with two rows of values:
"Sales Tax (%)", "NY"
"Sales Tax (%)", PA"
When I execute the following:
SELECT * From Foo WHERE Type LIKE '%Sales Tax ([%])%'
I get the rows returned I expect, where the row has a value in the Type column of "Sales Tax (%)"
But when I execute:
SELECT * From Foo WHERE Type = 'Sales Tax ([%])'
No rows are returned
Even if I omit the parenthesis around the % sign, it does not find the rows.
Is there something odd I am doing wrong, perhaps specific to Access SQL?
|
|
|
|
|
<edit>move on, nothing to see here except the proofs of to little sleep.</edit>
Access isn't SQLServer. You're not supposed to use brackets either.
I would strongly recommend renaming the offending fields.
More info here[^].
I especially like this part: "However, if you do use the special characters, you may experience unexpected errors."
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
modified 10-May-13 10:49am.
|
|
|
|
|
I am not sure I understand. The % character does not appear in any field names, or table names. The data type of both fields, named "Type" and "SubType" are text, and that text data can contain a % character as part of whatever text the user chooses to enter into the field, along with other special characters.
(I have an application where I prompt the user to enter a text value for the Type and SubType fields, and I save that text into those fields as a new row. The problem I have is that the user can enter a % as part of their user-entered text, and I need to be able to search on text field data for a % character they may have entered; I can put brackets around all other special characters when building my query and they are found fine, but the % just doesn't work for some reason when used in an = query.
|
|
|
|
|
My bad, I think my brain went to sleep before the rest of me did.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
JohnBlocker wrote: Even if I omit the parenthesis around the % sign, it does not find the rows.
So this:
SELECT * From Foo WHERE Type = 'Sales Tax (%)'
returns nothing?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
JohnBlocker wrote: When parsing user input that has SQL reserved characters
Parsing how? What application/language are you doing this in?
|
|
|
|
|
This could be an odd question, but, you tried
Quote: SELECT * From Foo WHERE Type = 'Sales Tax ([%])'
Cause, when your using '=' command, means that is HAS to be egual.
|
|
|
|
|
Hi everyone
I have a question,is it correct
connected data objects consist of connection,command,reader and dataadapter(why we need to DataAdapter in a connected model?),transaction,....
disconnected data objects consist of dataset,dataTable,datarow,dataadapter
so we have two main models connected and disconnected.
what is the rule of DataAdapter in connected model? why do we need to use of a dataadpter to fill a dataset like this in a connected model?
.....
sqlDataAdapter = new SqlDataAdapter(cmdString, sqlConnection);
sqlDataAdapter.SelectCommand = sqlCommand;
SqlDataAdapter sqlDataAdapter;
sqlDataSet = new DataSet();
sqlDataSet.Clear();
int intValue = sqlDataAdapter.Fill(sqlDataSet);
is it right we are shifting of connected model to disconnected model,if yes why?
|
|
|
|
|
I would not include DataAdapter in the "connected" category.
The "connected" paradigm is still appropriate for many applications, but less so with distributed applications.
DataAdapters cause me nothing but trouble; I don't use them. 
|
|
|
|
|
Is it correct we can fill a dataset with connected objects(connection,command,dataadapter) and without them(with data source window)? if yes so we are using of the connected objects to fill a disconnected object(dataset),right?
|
|
|
|
|
DataAdapters enable the disconnected paradigm.
|
|
|
|
|
And we can use of it form programming (dataset dt=new,....) and from toolbox in the visual studio,right?
|
|
|
|
|
what diffrence betwwen in two below table
with cteStudent(ID,Name,Family)
AS
(
select ID,Name,Family from tblStudent
)
select * from cteStudent
SELECT ID,Name,Family into #tblTemp FROM tblStudent
select * from #tblTemp
assume that i remove temp table after run two query.
which of this two query is better than another (in performance aspect)
thanks for any help
t
|
|
|
|
|
mehdi.sabet wrote: what diffrence betwwen in two below table The first will only work on Sql2005+, since that's when the Common Table Expression was introduced.
mehdi.sabet wrote: assume that i remove temp table after run two query.
which of this two query is better than another (in performance aspect)
What makes you think there's much difference in terms of speed?
It's not like there's "duplicate" functionality and programmers having to look for the "most efficient" version of a routine. Your hunting for speed in the wrong place.
Now, to answer the question; the second version is preferred, it'd be unnoticeable faster. A good reason would be if you'd need to do multiple mutations on the same set. A good reason to use the CTE would be recursion.
Good luck.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
On SQLServer you can think of the CTE as an inline view, while the temporary table will be materialized and can be indexed.
mehdi.sabet wrote: which of this two query is better than another (in performance aspect)
In this specific case probably the CTE, because the select is straight forward and directly streamed to output.
While the temp table needs to be materialized, if even just in memory, and selected from memory to the output.
If the CTE/temptable would be used in more than one place and/or the select could benefit from indexing the temptable, the result could be quite different.
On Oracle it's a bit different though. There a CTE can be materialized.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
As Jörgen Andersson said, cte is faster cause there's no IO on disk, it's just memory.
when you declare an #Temporary, you really create the table on your tempdb, that means that you have to write on disk. For a long range of information, you can say that is not that fast as use an cte.
If i'm not wrong, declare an variable ( Declare @Table Table (column) ) is faster as use an CTE , and less complicate, cause just create the table on Memory. BUT, you got to remember, that this will only use memory, for a long range of information, this mean that will use a lot of ram.
|
|
|
|
|
I need to export images from my SQL database into a .png format. Each image needs to have the client name (stored in db) as the name of the .png file.
I've tried google'ing the issue but there does not seem to be a clear path on how to do this. Is there a utility I can use to do this or do I need to code a process?
Any help/direction would be greatly appreciated!!
Thanks
Michelle
|
|
|
|
|
I'd go for the PowerShell option mentioned here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have data in input file given below -->
1,abc
2,xyz
------- End of data----
Notice i have an empty rows after second row.
I m doing bulk insert with FIELDTERMINATOR = ',',ROWTERMINATOR = '\n'. It works perfectly fine when bulk inserting after removing the empty records. But when there is empty record at end of file, it is throwing error given below and no records are inserted in db. I cannot ask the user to remove empty line at EOF.
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
|
|
|
|
|
searching for solution..... wrote: I cannot ask the user to remove empty line at EOF. Then you'll have to write something that removes that line for the user. As the example, I'd expect it to be invalid, as an empty row would consist of field-separators and a row-separator. Like this:
1,abc
2,xyz
, An empty line does not equal an empty row. It equals a row without fields.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi
i need get data of checkbox which inside a gridview this grid inside another grid i have used concept called masterdetail row inside it i have placed a control called checkbox now i need to that checked value......... how it is possible please help me with code using asp.net and C#......
Thanks in Advance................
|
|
|
|
|
Please choose the proper forum and post your question once only. I suggest you delete the other two.
Use the best guess
|
|
|
|
|
//for each row of gridview
CheckBox chk;
for (int i = 0; i< GridView1.Rows.Count; i++)
{
chk = (CheckBox)GridView1.Rows[i].Cells[chechboxcolumnIndexInterger].FindControl("checkboxID");
}
|
|
|
|