Create the following Stored Procedure in the master db
/* Procedure starts */
Create PROCEDURE sp_QueryToFile
( @db sysname,
@query VARCHAR(1000),
@file VARCHAR(255)
)
AS
SET NOCOUNT ON
SET @Query = 'SET NOCOUNT ON ' + @Query
EXECUTE ('master..xp_cmdshell ''osql -w8000 -r -s" "...
Hi,
I was looking for some help for Dynamic SQL in Oracle 9i.
My requirement is, I have a table, where a user's preferences are set. This table contains column_name, column_type & column_value. Now this information is organised in rows. I want to output this information using a REF...
Hi Shultz,
I have given the following query based on the Northwind database, you replace the tablename and columns with appropriate names.
select Top 10 * from Orders
Where OrderID Not In
(Select Top 10 OrderID from Orders Order By OrderID)
Order By OrderId
-Mukund.
Hi Beti,
use the Convert function. For your requirement use the following style of Convert function
Select Convert(varchar(10), datefield, 126) as somedate from
TableName
Replace the somedate, datefield and TableName with appropriate values.
-Mukund.
Hi Inder,
Sorry missed the alias in previous query, try this one.
Select RollNo, Name,
(Select count(*) from Students Where RollNo < s.RollNo) as SrNo
From Students s Order By RollNo
Here I am assuming the name of tables & columns, you can replace the names of students table and...
Hi Inder,
Try the following query.
Select RollNo, Name,
(Select count(*) from Students Where RollNo < s.RollNo) as SrNo
From Students Order By RollNo
Here I am assuming the name of tables & columns, you can replace the names of students table and columns RollNo & Name.
Hope this...
Hi Mirrorball,
You can do updates without changing the database. The trick is to prefix the table you want to update with the database name.
e.g.
Update databasename..TableName set ColumnName = ColumnValue where condition
-Mukund.
Hi transparent.
See if this solution works.
Use this statement at the start of your stored proc
SET ANSI_NULLS OFF
This will take care that the NULL values are compared properly.
At the end of the stored proc you can have the following statement.
SET ANSI_NULLS ON
Hope this helps...
Hi,
I needto update the data in ntext columns. I need to search for specific set of characters in the ntext data and replace that with another set of characters.
Anybody has a solution for this ?
-Mukund
Hi,
Anybody has any experience/idea of migration from Informix database to MS SQL Server database.
From point of view of tables (design), Views (syntax) & stored procedures.
Any pointer/comments/suggestions are welcome.
Regards,
Mukund.
Hi MaffewW,
In such case you can think of a front end tool that has the proper function like VB, Use that to retrieve, convert the address string to proper case and update the addres string back in the DB.
Mukund.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.