One of our vendor software developers created this SQL for SQL Server, but the vendor has gone. Can anyone explain what this command does. A user executes this at the command line of their machine
A command file has this:
osql -S (local)SQLEXPRESS -E -i DropDB.sql
The SQL file has this:
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'Caching')
DROP DATABASE [Caching]
i am using visual web developer 2005 and SQL 2005 with VB as the code behindi am using INSERT command like this Dim test As New SqlDataSource() test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").ToString() test.InsertCommandType = SqlDataSourceCommandType.Text test.InsertCommand = "INSERT INTO try (roll,name, age, email) VALUES (@roll,@name, @age, @email) " test.InsertParameters.Add("roll", TextBox1.Text) test.InsertParameters.Add("name", TextBox2.Text) test.InsertParameters.Add("age", TextBox3.Text) test.InsertParameters.Add("email", TextBox4.Text) test.Insert() i am using UPDATE command like this Dim test As New SqlDataSource() test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString").ToString() test.UpdateCommandType = SqlDataSourceCommandType.Text test.UpdateCommand = "UPDATE try SET name = '" + myname + "' , age = '" + myage + "' , email = '" + myemail + "' WHERE roll 123 " test.Update()but i have to use the SELECT command like this which is completely different from INSERT and UPDATE commands Dim tblData As New Data.DataTable() Dim conn As New Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True") Dim Command As New Data.SqlClient.SqlCommand("SELECT * FROM try WHERE age = '100' ", conn) Dim da As New Data.SqlClient.SqlDataAdapter(Command) da.Fill(tblData) conn.Close() TextBox4.Text = tblData.Rows(1).Item("name").ToString() TextBox5.Text = tblData.Rows(1).Item("age").ToString() TextBox6.Text = tblData.Rows(1).Item("email").ToString() for INSERT and UPDATE commands defining the command,commandtype and connectionstring is samebut for the SELECT command it is completely different. why ?can i define the command,commandtype and connectionstring for SELECT command similar to INSERT and UPDATE ?if its possible how to do ?please help me
i am using a OLE DB Source in my dataflow component and want to select rows from the source based on the Name I enter during execution time. I have created two variables,
enterName - String packageLevel (will store the name I enter)
myVar - String packageLevel. (to store the query)
I am assigning this query to the myVar variable, "Select * from db.Users where (UsrName = " + @[User::enterName] + " )"
Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, enterName,. I select that and when I click on OK am getting this error.
Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object.".
Can Someone guide me whr am going wrong?
myVar variable, i have set the ExecuteAsExpression Property to true too.
Hi. I am writing a program in C# to migrate data from a Foxpro database to an SQL Server 2005 Express database. The package is being created programmatically. I am creating a separate data flow for each Foxpro table. It seems to be doing it ok but I am getting the following error message at the package validation stage:
Description: An OLE DB Error has occured. Error code: 0x80040E0C.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object".
.........
Description: "component "OLE DB Destination" (22)" failed validation and returned validation status "VS_ISBROKEN".
This is the first time I am writing such code and I there must be something I am not doing correct but can't seem to figure it out. Any help will be highly appreciated. My code is as below:
private bool BuildPackage()
{
// Create the package object
oPackage = new Package();
// Create connections for the Foxpro and SQL Server data
MessageBox.Show("The DTS package was not built successfully because of the following error(s):" + sErrorMessage, "Package Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);
Hi,I'm using the sql TOP command to retrieve the top N number of results where N is a value passed into the stored proc...eg: select TOP(@N) table.*from table...etc..if @N is not passed into the stored proc then by default i want it to select every row from the table. e.g to achieve something similar to...select table.*from table...how can i do this with with as few lines of code possible? thanks!
Hello, i have this sql command: sqlcommand2.CommandText = "Select Count(UserIP) From InboundTraffic Where InboundURL Contains('" & SiteDomain(i).ToString & "') and DateTimeReceived > #" & Last30Days & "#" My problem is that it is counting every field in the coulmn UserIp even though every field under Inboundurl currently contains 'a' and SiteDomain has a value of something like google.com. Should it not be returning nothing? Thanks!
Hi! Suppose a company has ten branches and a total employees of 10,000 ones. At the employees' table, how may I calculate the difference between every employee's salary to the average salary of own branch and write to the other field of table, just with a SQL Command?
Employee: ID | Branch | Salary | DifferenceToAverage
I am using the bcp command to export a bulk text file into the database, bcp elearning.dbo.BulkData in mobile.txt -c -t, -SZOHL-02 -Usa -P1234567890 -E I have 6 fields in the table to which i am exporting data.One field is numeric and i have to set the identity to yes,It gives me an error string data trucncated. When i remove the identity field, i am able to export data.So, how do i tackle this prob?I used the -E attribute to keep the identity .But still i get the error. The text file has comma seperated fields.I am using sql server 2000
Hello, i'm a junior progammer, I must use the BCP command for create a file that is needed to be used by another program.I have my template to use EX.:
Hi, I have 5 columns in a table called B. 2 of it is Time and User. how do i add the all the time for an user and insert it into a table called C with columns User and Totaltime? For example,
Table B Time......User 0.2........A 0.2........A 0.3........B 0.4........B
so my table C should be as follows,
Table C User....Totaltime A...........0.4 B...........0.7
I am having trouble figuring out how to use the OLE DB Command (for updating a record). On the first tab (Connection Managers), I can select my database server under 'Connection Manager'. When I looked at the second tab (Component Properties) I thought, this does not seem to have anything related to choosing a data TABLE to use. The third and fourth tabs do not seem to work because they require an output and none is there, and I can't add one (?)
When I selected the 3rd tab, I see the following at the bottom of the window :
Error at ReadAL3Files [OLE DB Command [6638]]: An OLE DB error has occured. Error code: 0x80040E0C. An OLE DB record is available. Source "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object"
So I look at the properties for the components, to see if there is one where 'text' is not set. Then I think, maybe I have to enter the update statement directly (under SQL Command). There didn't seem to be a way to build this kind of statement, so I guessed at the syntax
update [dbo].[BriteMeter] set sampledatetime = [Column_7], GradeID = [Column_8] where SampleID = SampleID;
and switching to tab 3 and 4 showed a different error : Statement(s) could not be prepared Invalid column name 'Column 8' Invalid column name 'Column 7'
I've tried entering those column names as described here : http://technet.microsoft.com/en-us/library/ms141138.aspx. Tried putting them in quotes, square brackets, I always get that error.
Am I approaching this right or am I missing something?
Hi All. I'm using OLE DB Command in order to update my oracle DB. I use MS provider to connect to oracle (I tried the oracle provider too).
I try to execute the simple query as
UPDATE TABLE1 SET VALID_DATE_TO = to_date(?,'dd/mm/yyyy') WHERE UNIT_CODE=? AND VALID_DATE_TO = to_date('01/01/9999','dd/mm/yyyy')
I declare the appropriate parameters. So, the error is fell:
[OLE DB Command [1247]] Error: An OLE DB error has occurred. Error code: 0x80040E07. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80040E07 Description: "ORA-01861: literal does not match format string ".
[OLE DB Command [1247]] Error: The "input "OLE DB Command Input" (1252)" failed because error code 0xC020906E occurred, and the error row disposition on "input "OLE DB Command Input" (1252)" specifies failure on error. An error occurred on the specified object of the specified component.
[DTS.Pipeline] Error: The ProcessInput method on component "OLE DB Command " (1247) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
I am just wondering is there a way to run a dos command in the stored procedure? Please fill me in on how to go about doing if is there is a way. If this is not the correct forum to post this question, please let me know. Thanks in advance.
Say you have a table listing all the statecounties in the world with the country they are in. What I would like to to is get the top 10 counties by country.
I can get the the top 10 counties, but I cannot go that extra step to get it by country, so I get something like:
I'm using the following bcp command to copy data from EPICwareDestination table in another server(derby)
> bcp EPICWareDB.dbo.EPICWareDestination out €śC:Documents and settingsratnayakeMy DocumentsEPICWare€? €“n €“T - S Derby
But when I run this in command promt , I get a error message.
It says user name is not provided, either use -U to provide the user name or use -T for Trusted connection When I type the same comman again, it gives a different error message.
Then it says SQLState = 42S02, NativeErros = 208 Erros = [microsoft][sql native client][sql server]invalid object name 'EPICWareDB.dbo.EPICWareDestination'
In the second link under supported platforms it given as below:
Platforms
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Does this mean I can use this class and object in SQL Mobile ?
Hi, I have a comma seperated string ('s1,s2,s3,s4') which is passed to my stored procedure. I need to format the string and form a new string so that i can use it on a sql command which goes like this
SELECT NAME FROM NAME_LIST WHERE ( NAME NOT IN (@Temp)
Where the @Temp is the new string i need to form. Can any one suggest a method to do this ? regards
Iam trying to generate the increment value for a column by taking Maximum value of that field by using OLE DB Command Transformation.
This is the query iam using for that : select max(ApplicationId)+1 as APPLICATIONID from Source..Applications
Iam finding difficulty in getting the 'APPLICATIONID' as the out put from OLEDB Transformation.OLE DB is not going to work with out any parameters ?can you please throw some light on this .First time iam using this transformation.
Another alternate solution is generating through script task (Thanks Jamie Thomson for his article).But i dont know how i can modify this to get the Max value instead of declaring some constant value for increment
Public Class ScriptMain Inherits UserComponent Dim Counter As Int32 Public Sub New() Counter = 1006 End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer) ' ' Add your code here ' Counter += 1 Row.APPLICATIONTASKID = Counter
End Sub
End Class
Please me help me in finding one solution from the above two