I am wondering how to create or export CSV file from SQL? Is tehre any function for that similar as pgsql2shp?????
I would appreciate your ideas, tip or solutions.
i am passing values from a textbox into a sql statement in ACCESS
i do not understand the difference in the usage of these two properties
when i set the the .text property to something, how does the .value property get affected?
when i do want something to be displayed in the textbox should i be using the value or text property?
I get the following error in the query below:
#1064 - You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near ')))' at line 1
Code Snippet:
INSERT INTO test_bans( ip, Expiration )
VALUES (
"0.0.0.0", DateAdd(
"d", 1, Date( )
)
)
Table creation query
CREATE TABLE test_bans (
ID smallint(6) NOT NULL AUTO_INCREMENT,
IP text NOT NULL,
Expiration DATETIME NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM;
What am I missing?
I have been asked in an interview, To write a sql query which fetches the first three records with highest value on some column from a table. i had written a query which fetched all the records with highest value, but didnt get how exactly i can get only first three records of those.
could you help me in this.
thanks.
Hi i'm trying to manipulate the sql connection string so instead of running the original copy of our database it runs from the copy one folder up in our C# project.
I am trying to use open query to run a stored procedure in a remote database, and insert it into a table in my local database:
-- this works
exec remotesvr.sys.dbo.golden_table 'some', 'parameters'
While the above works out, I try the following:
insert into my_local_table
exec remotesvr.sys.dbo.golden_table 'some', 'parameters'
I get a SQL error to the effect of 'unable to begin a distributed transaction'.
Is there any way around this?, i.e. can I execute take the results of a remote stored procedure and put its contents in a local table?
I want to execute query in side the db.sql file using MySQL 5.1 in windows environment. Can any one help me to this. I want to do this by runing a bat file.
I am using c# with asp.net and SQL Server 2005 as backend. I want to use dropdown list control in a form to populate a textbox. The dropdown control is linked to a column in the database. How can I code this in c#?
I have table "PICKITEM"
PARTID QTY
A 1
A 3
B 11
C 8
D 5
D 3
I need a select statement that will return one line for like PARTIDs and add the qty field to together, yet also return the rest of the lines in the table as is
PARTID QTY
A 4
B 11
C 8
D 8
Probably a newb question, but I am new to SQL syntax and queries. Any help in getting me on the right path would be appreciated!
I have a MySQL table with a column called "priority". The column can have two values: high or low. I want to select 8 records from the table at random, but I want 6 of them to be high priority, and 2 of them to be low priority. If possibly, I would like to do it in one SQL statement. Is there any way to do two LIMITS in one query based on this kind of criteria?
Hi I want to know how to take a backup of database using programatically in VB.net of SQL Server 2005. if you are having and idea about it then pls send me the code for that.
Not quite sure what I'm missing, but my SQL statement is only returning one row.
SELECT
tl.*,
(tl.topic_total_rating/tl.topic_rates) as topic_rating,
COUNT(pl.post_id) - 1 as reply_count,
MIN(pl.post_time) AS topic_time,
MAX(pl.post_time) AS topic_bump
FROM topic_list tl
JOIN post_list pl
ON tl.topic_id=pl.post_parent
WHERE
tl.topic_board_link = %i
AND topic_hidden != 1
ORDER BY %s
I have two tables (post_list and topic_list), and post_list's post_parent links to a topic_list's topic_id.
Instead of returning all the topics (where their board's topic_board_link is n), it only returns one topic.
Say I have these tables:
people(id, name),
cars(person_id, car)
and this query:
SELECT c.car
FROM people as p, cars as c
WHERE c.person_id = p.id
AND p.id = 3
I want the c.car column to take its name from the name field in the people table, like this (invalid SQL, just to illustrate):
SELECT c.car AS(SELECT name FROM people WHERE id = 3)
How do I do that?
I have a asp:GridView with a HyperLinkField. It's DataNavigateUrlFormatString property is set to View.aspx?id={0}&isTechnical={1}
Select command of appropriate SqlDataSource returns columns of type INT and BIT (from SQL Server 2008).
So displayed string becomes something like View.aspx?id=1&isTechnical=1. But I want to display isTechnical=true|False, i.e. Convert.ToBoolean(row["isTechnical"]).ToString().ToLowerInvariant().
How to implement such conversion in page markup?
Hi,
I have the following table:
bar_id, bar_name, subscription_id_fk, sub_name
eg:
1, Hard Rock, 2, Gold
2, TGIF, 1, Free
Now I need and SQL to extract this table, but where sub_name = Gold, I need to double the subscription_id_fk.
Can you please help
?
VB6 & SQL Server 2005
When i run the Windows based Software exe file,
it is showing the login page,
after login page - no screen is displaying,
I checked the task manager, in task manager it is showing as software as running,
But there is no page is appearing.
Is any firewall blocking or some other issue. But software is running with out displaying anythings.
How to solve this issue?
Hi,
I converted an old sql server database from 2000 to 2005 and forgetten to add old indexes to the new db.
is there any way to copy the old indexes to the new db?
any help?
OK, see the numbers? I can barely see them because my Visual Studio 2010 theme has the backround as almost-black, and the numbers show up in the default color, which is black. I can't figure out which setting changes the color for a number in a .sql file. Does anyone know?
Please, could you answer my question.
How to remove digits from the end of the string using SQL?
For example, the string '2Ga4la2009' must be converted to 2Ga4la. The problem is that we can't trim them because we don't know how many digits are in the end of the string.
Best regards, Galina.
i have oracle background,
i am looking for oracle v$sql view in mysql in order to see last queries has been run on all sessions in database
how can i see this in mysql ?
I have been tasked to shrink a SQL server 2005 database. This ia a live database and is runing at about 35gb.
How do I shrink a database?
Can this be done while that database is live?
How big will that database bw when it has been shrunk?
Thanks in advance.
I need to get all rows tha are valid, ValidDate is column that shows how long these database items are valid. I need to get only valid items from the database. How can I do that? I use SQL Server.
I had to restore may database to 1 day erlier, so My database is missing data from a day before, and this databse has been used by users since the restoration.
How do I generate script/stored procedure to copy just the missing data from the backup database into my current database.
There are PK and FK relationships that need to be considering.
I'm using SQL server 2005
Thanks for your help.
Aein
How to connect to a database (any natively supported by .NET) - SQL Server 2008 or Access - from a Windows Forms application written on VC++/CLI (compiler ver. 16.0 from .NET 4.0)
Is there a catchall function somewhere that works well for sanitizing user input for sql injection and XSS attacks, while still allowing certain types of html tags?