New To Ms Sql Having Trouble With Very Basic Commands

Jan 21, 2004

I'm more used to mysql, which i haven't coded for a while, but how do you show tables? or show databases you have available from the osql prompt?

View 3 Replies


ADVERTISEMENT

Having Trouble Configuring The SqlDataSource Control's Update And Insert Commands

Jul 24, 2007

I've just finished configuring the SELECT command for the SqlDataSource in my ASP.NET 2.0 web app.  It works fine and runs against a SQL Server 2005 database, using a stored procedure that I've written.
So, then I went to configure the SqlDataSource for the UPDATE and INSERT commands, and I've written two SP's for those as well.  In the designer the second form of the wizard asks for the Select statement.  I've already given that for the SELECT statement in the third form, and I also select the INSERT tab to specify the SP I want to use for inserting data and the UPDATE tab to specify the SP I want to use for updating data.  However, there appears to be no way that I can specify what the parameters are supposed to be for anything other than the SELECT command, through the designer.  Is that correct, or have I missed something?
 

View 11 Replies View Related

Trouble Doing Basic Insert Into Sql Db

Jul 18, 2006

i am just trying to insert a title and category row into a table in my
database, however, the page works as planned, bu no data is inserted,
and i am not getting any error messages, so i am for a loss.

here is the code for the testInsert.aspx page:

<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data"  %>
<%@ Import Namespace="System.Data.SqlClient"  %>
<html>
<body vlink="red">
<h1>title and category</h1>

<form id="Form1" runat="server">

<h2>Enter title and category</h2>

<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs)
   
        DetailsView1.ChangeMode(DetailsViewMode.Insert)
End Sub

Protected Sub DetailsView1_ItemInserted( _
    ByVal sender As Object, ByVal e As _
    System.Web.UI.WebControls.DetailsViewInsertedEventArgs)
   
        Response.Redirect("../Pages/Home.aspx")
End Sub

Protected Sub Detailsview1_ItemCommand( _
    ByVal sender As Object, ByVal e As _
    System.Web.UI.WebControls.DetailsViewCommandEventArgs)
   
        If e.commandName = "Cancel" Then
            Response.Redirect("../Pages/Home.aspx")
        End If
End Sub
</script>
Enter your e-mail address
<br />

<asp:DetailsView ID="DetailsView1" runat="server"
Height="50px" Width="100%" AutoGenerateRows="False"
DataKeyNames="AdNum" DataSourceID="SqlDataSource1"
CellPadding="4" ForeColor="#333333" GridLines="None"
OnItemInserted="DetailsView1_ItemInserted"
OnItemCommand="DetailsView1_ItemCommand">

    <Fields>
        <asp:BoundField DataField="Title"
            HeaderText="Title"
                SortExpression="Title" />
        <asp:BoundField DataField="Category"
            HeaderText="Category"
            SortExpression="Category" />
        <asp:Commandfield ButtonType="Button"
            ShowInsertButton="True" />
    </Fields>
   
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
   
    <FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />
   
</asp:DetailsView>

&nbsp;

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString=
"<%$ ConnectionStrings:ASPNETDBConnectionString3 %>"
InsertCommand="INSERT INTO newInsert (Title, Category) Values(?, ?)"
ProviderName=
"<%$ ConnectionStrings:ASPNETDBConnectionString3.ProviderName %>"
SelectCommand="SELECT Title, Category FROM newInsert" >

    <InsertParameters>
        <asp:Parameter Name="Title" Type="String" />
        <asp:Parameter Name="Category" Type="String" />
    </InsertParameters>
</asp:SqlDataSource>

</form>
</body>
</html>


and here is the portion of my web.config file that references the connectionstrings:

<connectionstrings>
<add name="ASPNETDBConnectionString3" connectionString="Data
Source=.SQLEXPRESS;AttachDbFilename=&quot;C:Documents and
SettingsJordan MikoMy DocumentsVisual Studio
2005WebSitesWebSite29App_DataASPNETDB.MDF&quot;;Integrated
Security=True;Connect Timeout=30;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>

The connectionstring, table, and rows are all correctly spelled
please let me know what i am doing wrong or an easier way to do it


jordan

View 2 Replies View Related

Basic Replication Trouble.

Nov 7, 2006

I'm trying to run a simple update script on this database which iscreated from a replication agent. Several individual databases arereplicated into one consolidated. I've not worked with replicationbefore and I was hoping someone could tell me what this error means.UPDATECUSTOMERSET[TIMESTAMP]='20060920090453'[IVBTYPE]='M 'WHERE[ROWID]='9f83bc89-76f8-4140-a0cc-58fa34962638'yields:Server: Msg 208, Level 16, State 1, Procedureupd_0119B5A9AA624A55AF1B73F2E32A7A0C, Line 14Invalid object name 'dbo.sysmergearticles'.Do I have to do something to the database before trying to update it?

View 1 Replies View Related

SQL CE Trouble In Visual Basic 6

Dec 14, 2006

I use SQL Server 2005 Compact Edition RC1 with Visual Basic 6.0. connection provider that i use is Microsoft.SQLSERVER.MOBILE.OLEDB.3.0. for database management i use SQL Server Management Studio. some query can't execute in visual basic but in sql management studio, that query can run very well. for example:
1. select KodeSatker, KodeSatker + ' - ' + Nama as Nama from TMSatker where len(kodesatker)=3 order by KodeSatker
2. Select a.kdprog, a.nama, b.kodesatker + ' - ' + b.nama as SKPD, a.nonurusan from TMProgram a left join TMSatker b on substring(a.kdprog, 1, len(a.kdprog) - 2) = b.kodesatker

2 query above can run in sql management studio, but in visual basic 6.0, that query have an error.
error msg:run time error '2147217887 (80040e21)':
multiple-step operation generated errors. check each status value

how to solve that problem?
thanks before.

View 5 Replies View Related

Trouble With Basic Table To Table Insert

Nov 26, 2001

I'm a horrible noob everyone, so my apologies come up front.

I know Oracle allows me to just do an

INSERT INTO table
SELECT column1, column2
FROM table2

But I cannot get this to work in MS SQL 2000. (See question #3)



Here's my script that I'm trying to execute from Enterprise Manager:

From this table:

CREATE TABLE ISIS_DATA
(ISIS_STATUS_ID VARCHAR(15) CONSTRAINT ISIS_DATA_ISIS_ID_PK PRIMARY KEY,
ISIS_NAME VARCHAR(50),
ISIS_CLASS_EXPIR_DAT VARCHAR(20),
ISIS_SEX_BD_CAT_SCHL VARCHAR(20))

Where this is a sample row of data:

A123456789 THOMAS, CHARLES B. 009/11/01 M05/04/511G

I want to run that data through some substrings etc. and dump it into another table like this:

//THIS TABLE WILL BE WHERE WE PUT THE RESULTING DATA FROM
//EXECUTING THE SUBSTRs AND OTHER FUNCTIONS TO PREP THE DATA FOR BASIS.
CREATE TABLE ISIS_DATA_PREP
(ISIS_STATUS_ID VARCHAR(15),
STATUS VARCHAR(5),
STUDENT_ID NUMERIC(15) CONSTRAINT ISIS_DATA_PREP_STUDENT_ID_PK PRIMARY KEY,
LAST_NAME VARCHAR(25),
FIRST_NAME VARCHAR(20),
MID_INIT CHAR(1),
CLASS NUMERIC(2),
EXPIR_DATE VARCHAR(10),
SEX CHAR(1),
BIRTHDAY VARCHAR(10),
CAT NUMERIC(3),
SCHOOL VARCHAR(5))


Using this script so far:


INSERT INTO ISIS_DATA_PREP
SELECT B.STATUS, B.STUDENT_ID, B.LAST_NAME, B.FIRST_NAME, B.MID_INIT,
B.CLASS, B.EXPIR_DATE,
B.SEX, B.BIRTHDAY, B.CAT, B.SCHOOL, A.ISIS_STATUS_ID
FROM ISIS_DATA A,
(SELECT SUBSTRING(ISIS_STATUS_ID, 1, 1) STATUS, SUBSTRING(ISIS_STATUS_ID, 2, 9) STUDENT_ID,
ISIS_NAME LAST_NAME, SUBSTRING(ISIS_NAME, 5, 1) FIRST_NAME, SUBSTRING(ISIS_NAME, 5, 1) MID_INIT,
SUBSTRING(ISIS_CLASS_EXPIR_DAT, 1, 1) CLASS, SUBSTRING(ISIS_CLASS_EXPIR_DAT, 2, 8) EXPIR_DATE,
SUBSTRING(ISIS_SEX_BD_CAT_SCHL, 1,1) SEX, SUBSTRING(ISIS_SEX_BD_CAT_SCHL, 2, 8) BIRTHDAY,
SUBSTRING(ISIS_SEX_BD_CAT_SCHL, 10, 1) CAT, SUBSTRING(ISIS_SEX_BD_CAT_SCHL, 11, 2) SCHOOL,
ISIS_STATUS_ID
FROM ISIS_DATA) B
WHERE A.ISIS_STATUS_ID = B.ISIS_STATUS_ID


I keep getting this error:


Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.


QUESTION #1 - Is there an equivalent in MS SQL 2000 to Oracle's TONUM function?




So, to get around this I change all the fields in the receiving table (ISIS_DATA_PREP) to a varchar so there is no conversion necessary at this time.


Now I get this message:


Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.



I look up this error on MS's knowledge base and get something along these lines:

...Because the truncated string is shorter than the maximum length, the char column that does not allow a null value and the char variable is padded with trailing blanks while the varchar column will not store trailing blanks....




QUESTION #2 -

What am I doing wrong on the field structure on the receiving table of the input command? I experimented by setting all fields to VARCHAR(25) so it would accept more data and not truncate, but still get the same message.



QUESTION #3 -
My main question was for the syntax for INSERTing into a table from another table the rows in MS SQL. Basically copying the data. I have it for Oracle, but MS SQL doesn't seem to take it in that format.



Sorry for the absolutely massive post. : ) And thanks for any feedback.

Lance

View 2 Replies View Related

What Is Going On Here? SQL Commands And ODBC Commands Aren't Compatible

Oct 1, 2004

I'm building a simple webform, except Visual Studio and my service provider have combined to drive me nutty.

First, I MUST use an ODBC connection to my remote SQL Server do to some unknown configuartion problem. I've been playing with Visual Studio for only a month, so normally when something goes wrong I can go look in the mirror and find the culprit. This is different. I've got a totally functional web form with a SQL Connection, but when I try to change it to an ODBC Connection, I get the following error.

An OdbcParameter with ParameterName '@CertHolder' is not contained by this OdbcParameterCollection

My coding is fine because I stole it straight from the walkthrough and it works. But the specifications that Visual Studio provide are quite suspect. Please note the failure to include some key "@" signs.


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.cmdUpdate = New System.Data.SqlClient.SqlCommand
Me.cmdGetAll = New System.Data.SqlClient.SqlCommand
Me.cmdSelect = New System.Data.SqlClient.SqlCommand
Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
Me.OdbcGetAll = New System.Data.Odbc.OdbcCommand
Me.OdbcSelect = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdate = New System.Data.Odbc.OdbcCommand
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "this works fine"
'
'cmdUpdate
'
Me.cmdUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip, CertHolder = WHERE (CertHolder = @Cert" & _
"Holder)"
Me.cmdUpdate.Connection = Me.SqlConnection1
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Name", System.Data.SqlDbType.NVarChar, 50, "Name"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address", System.Data.SqlDbType.NVarChar, 50, "Address"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address2", System.Data.SqlDbType.NVarChar, 50, "Address2"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@City", System.Data.SqlDbType.NVarChar, 50, "City"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@State", System.Data.SqlDbType.NVarChar, 50, "State"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Zip", System.Data.SqlDbType.NVarChar, 50, "Zip"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))
'
'cmdGetAll
'
Me.cmdGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.cmdGetAll.Connection = Me.SqlConnection1
'
'cmdSelect
'
Me.cmdSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE (CertHolder = @CertHolder)"
Me.cmdSelect.Connection = Me.SqlConnection1
Me.cmdSelect.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, "CertHolder"))
'
'OdbcConnection1
'
Me.OdbcConnection1.ConnectionString = "This works fine"
'
'OdbcGetAll
'
Me.OdbcGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.OdbcGetAll.Connection = Me.OdbcConnection1
'
'OdbcSelect
'
Me.OdbcSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE CertHolder = @CertHolder"
Me.OdbcSelect.Connection = Me.OdbcConnection1
Me.OdbcSelect.Parameters.Add(New System.Data.Odbc.OdbcParameter("CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, "CertHolder"))
'
'OdbcUpdate
'
Me.OdbcUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip WHERE CertHolder = @CertHolder"
Me.OdbcUpdate.Connection = Me.OdbcConnection1
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Name", System.Data.Odbc.OdbcType.NVarChar, 50, "Name"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address", System.Data.Odbc.OdbcType.NVarChar, 50, "Address"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address2", System.Data.Odbc.OdbcType.NVarChar, 50, "Address2"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("City", System.Data.Odbc.OdbcType.NVarChar, 50, "City"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("State", System.Data.Odbc.OdbcType.NVarChar, 50, "State"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Zip", System.Data.Odbc.OdbcType.NVarChar, 50, "Zip"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Original_CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))

I NEVER EVER TYPED ORIGINAL_CERTHOLDER IN THE SQL PREPARATION

End Sub
Protected WithEvents btnSave As System.Web.UI.WebControls.Button
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents ddlCertHolder As System.Web.UI.WebControls.DropDownList
Protected WithEvents txtName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress As System.Web.UI.WebControls.TextBox
Protected WithEvents ddlCH As System.Web.UI.WebControls.DropDownList
Protected WithEvents cmdUpdate As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdGetAll As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdSelect As System.Data.SqlClient.SqlCommand
Protected WithEvents txtAddress2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
Protected WithEvents OdbcGetAll As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcSelect As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcUpdate As System.Data.Odbc.OdbcCommand

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region


Comments? Suggestions, I am not positive about how to fix this.

View 2 Replies View Related

Commands

Jan 7, 2008

Hi All,

I have these two commands that I execute at the end of my stored procedure. I get an email every time I execute this stored procedure whether the select statement returns a value or not. But I only want to get an email if select statement returns an Error value. How can I accomplish this?

set @cmd = 'osql -S server -U user -P psswd -q "set nocount on; select distinct(rtrim(col1)) from ##table where datediff(dd,col2,getdate()) = 1 and (col1 like ''%Error: %'')" -h-1 -w 1025 -o J:MyFolderErrorLogMsg.txt'

EXEC master.dbo.xp_cmdshell @cmd, no_output

SET @email = 'mailsend -f someone@mymail.com -d -smtp -t someone@mymail.com -sub "Error Log Errors" -m J:MyFolderErrorLogMsg.txt'

EXEC master.dbo.xp_cmdshell @email, no_output


Thanks.

View 2 Replies View Related

Commands

Jan 7, 2008

Hi All,

I have these two commands that I execute at the end of my stored procedure. I get an email every time I execute this stored procedure whether the select statement returns a value or not. But I only want to get an email if select statement returns an Error value. How can I accomplish this?

set @cmd = 'osql -S server -U user -P psswd -q "set nocount on; select distinct(rtrim(col1)) from ##table where datediff(dd,col2,getdate()) = 1 and (col1 like ''%Error: %'')" -h-1 -w 1025 -o J:MyFolderErrorLogMsg.txt'

EXEC master.dbo.xp_cmdshell @cmd, no_output

SET @email = 'mailsend -f someone@mymail.com -d -smtp -t someone@mymail.com -sub "Error Log Errors" -m J:MyFolderErrorLogMsg.txt'

EXEC master.dbo.xp_cmdshell @email, no_output


Thanks.

View 2 Replies View Related

Sql Commands

Jan 13, 2004

How can I get all SQL commands in SqlServer? How can I trace this commands?

Thansk

View 1 Replies View Related

SET Commands

Feb 8, 2006

Hello,

I finally got access to Northwind/pubs.

I would like to know when and why do we use the following set commands. The SQL Server BOL does not say why and when to use these commands.

Thanks in advance!!!
sqlnovice123



Option Default Setting
Set nocount OFF
Set rowcount 0
Set ansi_nulls ON
Set quoted_identifier ON

View 3 Replies View Related

2 SQL Commands In One Action

Nov 29, 2007

Hi guys,I wanna ask bout the problem with my web application. I'm doing a select a statement from table 1 and and with the query results i got, i need it to store the result on table 2. How will i do this?  I need your tips and suggestions.

View 1 Replies View Related

Multiple SQL Commands At Once

Jan 8, 2006

I'm running asp.net 2.0 and acessing MSSQL 2K.  I am trying to run a query in which I need to set up variables first.  I tried the following group of commands as shown, passing it to the  SqlDataReader object, but it failed.. does anyone know how i can pass multiple SQL commands?         MainQuery = "declare @MinGrades as Table(GradeID Bigint) " & _                    " INSERT @MinGrades SELECT MIN(CreditGrades.SplitID) AS Expr1" & _                       "  FROM          CreditGrades INNER JOIN" & _                        "    CreditGradeSplits ON CreditGradeSplits.CreditGradeSplitID = CreditGrades.SplitID " & _                        " WHERE      (CreditGrades.x0x30 = - 1 OR " & _                        "    CreditGrades.x0x30 >= 0) AND (CreditGrades.x1x30 = - 1 OR " & _                        "    CreditGrades.x1x30 >= 0) AND (CreditGrades.x2x30 = - 1 OR " & _                        "    CreditGrades.x2x30 >= 0) AND (CreditGrades.x3x30 = - 1 OR " & _                        "    CreditGrades.x3xNOD >= 0) " & _                        " GROUP BY CreditGradeSplits.CreditGradeGroupID" & _                    " Select * from @MinGrades "

View 2 Replies View Related

SQL Commands Disappearing!?!?!?!

Nov 7, 2001

I am experiencing a situation where I issue a lengthy SQL command to MS SQL Server 7.0 through MTS and it "disappears" - no errors or recordsets are returned. The command is "SELECT * FROM CUSTOMERS WHERE LASTNAME LIKE 'SMITH%'". When I issue this command from SQL Query Analyzer it takes 27 seconds to return 87 rows. When I issue this exact same command through MTS it does not return at all.

I've used the SQL Profiler to analyze the requests. It shows the commands from MTS starting but they never stop (or at least the profiler never reports them as stopping). The same commands coming from Query Analyzer are reported as starting and stopping without fail.

Here's a twist: I can issue less demanding commands (ie, one that doesn't take so long to process) through MTS and they come back fine. For example, when a user logs into my application, I use an SQL statement to verify the user name and password and status the user as logged in. This is routed through MTS and it comes back fine in less than a second. Same application, same PC, same MTS and SQL server, same SQL database. The only difference is that the CUSTOMERS table has over 800,000 records and the USERS table has only 5 records.

PLEASE HELP!

View 1 Replies View Related

Using The DBCC Commands

Jul 26, 2004

Hi,

I am very new to sql server and I have been reading up on the dbcc commands. For instance, DBCC SHOWCONTIG where do I execute this command? I went into the cmd prompt and opened osql and typed:
1> DBCC SHOWCONTIG
2> GO

This gives me the information for what I assume is the master database. But, how do I use this command under the other databases?

Also, I have been trying to learn how to determine when to do index maintenance by using the index tuning wizard. But, I don't know what a workload is. Can someone point me in the right direction or give me some information about this topic.

Thanks,
Laura

View 5 Replies View Related

Normalizing Using Sql Commands

Aug 28, 2006

Hi

Please can someone point me in the direction, i built a very badly designed database consisting of only one huge table when i first started databases, since learning about normalization i have designed and set up a new database which consists of many more tables instead of just the one. My question is where do i start in transfering the data from the old single tabled database to my new multi-tabled database?

I have MS SQL server 2005 managment studio if that helps, but want to transfer around 200,000 rows of data into the new database. Both new and old databases are on the same server.

thanks in advance

View 11 Replies View Related

Run Commands Only Between Hours

Feb 29, 2012

I have a job that runs between the hours of 10 PM and 9 AM. It launches a controller stored procedure that will call other stored procedure until the entire process is done.I would like the controlling stored procedure to only call the steps between the hours of 10PM and 9AM also.. So at 8:59 AM it will start the next step, but at 9:00 AM it will exit.

View 6 Replies View Related

Undeleveired Commands

Nov 4, 2007

hi all
when i set up a new subcription ,i notice in hte replication monitor thet this subscription 'uninitialize subscription' and the are 70 undelevier commands.

how can i fixed this problem,or how can i remove those undeleveirs commands?

thanx

View 1 Replies View Related

Log All Commands Executed In QA

Jul 23, 2005

Hi All,Is there way that commands executed in the query analyzer get loggedautomatically?TIAJoriz

View 3 Replies View Related

Output Of Sql Commands

May 19, 2006

Hi,

Suppose there are two tables employee and salary and a,b are two instances of tables employee and salary.There are 20 records in each table.Then what will be the result of the following query



select a.*, b.* from employee a, salary b.

regards

arun



View 3 Replies View Related

Commands That Cannot Be Used With Mirroring

Feb 6, 2007

Hi al,



Are there commands that are not supported when mirroring is active? (truncate table, bcp, set identity insert on/off etc.)







View 8 Replies View Related

DBCC Commands

Aug 7, 2007

Hi

Can we use
DBCC CHECKIDENT ('dbo.MyTable', RESEED, 0)
Command in Stored procedure. Which executes daily.

Thanks
Sridhar K

View 4 Replies View Related

Behind The Scenes SQL Commands

May 25, 2006

Hello, I am running SQL 2000 SP4 on a Windows 2003 standard edition server.

The SQL database gets changed/updated through a web interface. I was wondering if there was any way for me to see which SQL commands were being run on the database when changed like deleting/inserting users are being applied from the Web frontend?



Any help is appreciated, thanks.



Robert

View 1 Replies View Related

How SQL Commands Get Executed?

Apr 17, 2007

When we send any SQL command to database engine , how exactly it gets executed?

View 7 Replies View Related

Integrity With Multiple Commands

Aug 10, 2006

How can I make sure that a couple of commands are either all executed on the database or none of them. For example right now I have an insert, update and delete command. I'm calling each of them with a SqlCommand. So I am afraid that that one of them might be executed, then there's a bad connection and the other two are not. How can I prevent this so that only all commands or nothing is executed on the database?

View 2 Replies View Related

Two Update Commands For A SqlDataSource?

Jan 16, 2008

Is there a way to have two sql update commands so I can use both during an update depending on which row it is?

View 1 Replies View Related

Retrieving Database DDl Commands

Mar 25, 2008

 Hi everyoneI created a database graphically in VS2005.Now I want the text version of those DDL(create) commands. Question is where and how are those commands stored in SqlServer  I have the management studio too. Any ideas?? 

View 2 Replies View Related

Questions On SQL Join Commands

Mar 29, 2008

Please forgive me if my questions seem very simple. I'm trying to pick up vb.net, asp.net, and SQL all at the same time, and while making progress in some areas I'm finding other questions I have harder to figure out where to look for answers.
 First question - if I want to join 2 tables do the fields I'm joining on have to have the same name? I know they have to be of the same type, but does the name itself matter? For instance in this line of code I try to join forums
objdataadapter.SelectCommand.CommandText = "select * from msg_forums" & "JOIN users ON msg_forums.forum_moderators = users.user_ID"
Second question nagging at me, since I specify the table <msg_forums and users> before the field names <forum_moderators and user_ID> does it matter which one comes first? See, my primary table in this line is msg_forums, so do I have to specify it's field first, or does that even matter (or do I have it backwards and need to specify the other one first)?
 Last question, and of course the root of what's caused me to wonder about all of this. I'm getting an error similar to some of what I found in the forums, but it's slightly different in that it says there is a problem near "OR". As far as I can tell I've written this correctly, and so, I'm stumped. Here is the error followed by the code. Thanks a bunch for any assistance anyone offers. :-) Incorrect syntax near the keyword 'ON'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'ON'. 
'This time trying to learn an adapter instead of a reader, will also try a join
'Build the connectionDim StrConnection As String = (System.Configuration.ConfigurationManager.AppSettings("DbConnect"))
Dim objConnection As New SqlConnection(StrConnection)Dim objdataadapter As New SqlDataAdapter()
Dim objdataset As New DataSet()
'set the SelectCommand Properties objDataadapter.SelectCommand = New SqlCommand
objdataadapter.SelectCommand.Connection = objConnection
'try after renaming to fields to match
objdataadapter.SelectCommand.CommandText = "select * from msg_forums" & "JOIN users ON msg_forums.user_ID = users.user_ID"
'Try without specifying the table
'objdataadapter.SelectCommand.CommandText = "select * from msg_forums" & "JOIN users ON user_ID = user_ID"
'Original attempt
objdataadapter.SelectCommand.CommandText = "select * from msg_forums" & "JOIN users ON msg_forums.forum_moderators = users.user_ID"
objdataadapter.SelectCommand.CommandType = CommandType.Text
'open the database connection
objConnection.Open()
'Fill the dataset with object data giving the dataset to use and the table name (primary table even when pulling from a couple)objdataadapter.Fill(objdataset, "msg_forums")
'close connection
objConnection.Close()
'Set DataGridView properties
grdforums.AutoGenerateColumns = True
grdforums.DataSource = objdataset
grdforums.DataMember = "msg_forums"End Sub
End Class

View 2 Replies View Related

Load And Unload Commands

Nov 30, 1999

How do you load and unload data using the commands load and unload in SQL Server? I am using UNIX Script to call isql.exe

Ex:
This code gives an error of "Incorrect syntax near keyword 'to'
unload to '/tmp/lot/test.unl'
select * from test
go

View 1 Replies View Related

Undistributed Commands Not Decrementing

Apr 7, 2008

I was pointed to this forum by one of the admins who has started doing some consulting work for us. We did a major conversion over the weekend for our main production server to SQL 2005 from SQL 2000. We have used replication to go from the live OLTP server to a few dedicated report servers for all of our reporting needs. In 2000 this was pretty well established (though a pain when we had to migrate in changes; I love the 2005 schema features for replication).

The only problem we have really encountered today, the Day After, involves replication. A few minor things involve lack of knowledge (like nonclustered indexes don't replicate by default, that was an OOPS). But one thing I haven't figured out yet.

Replication is working -- we are updating three servers, and all three servers are getting updates. I have run a validation on one of them and it passed in full. However, the "undistributed commands" count never goes down. It actually keeps going up and up. I verified that by first running this on the subscriber:




select transaction_timestamp
from MSreplication_subscriptions



And taking the results of one of the three rows that came back and executing this with it:




sp_browsereplcmds @xact_seqno_start = '0x00000231000006ED000100000001'




which brought back all of the "undistributed commands". Within that list, I looked for sp_MSins_ procedures. I found a few and looked up on the subscriber the value to be inserted -- and it existed on the subscriber. So it still is in MSrepl_commands even though it has been sent out.



I am afraid that eventually the system will "think" that the process isn't working and deactivate the subscriptions. Also this is useless as a monitor. Since this is our first major replication in 2005, I am willing to bet that we are missing something. Does anyone have any advice?

View 1 Replies View Related

SQL Commands For Selected Date

May 9, 2008

I want to display the data in a datasheetview in ms access project.
The data is between particular date. What command should i used for this?

My form contailn feilds : UserId,FromDate,ToDate

Enter the userid & Particular date & after click on submit data for that period should display in datasheet view.

Please help me in this as soon as possible.

View 2 Replies View Related

Sql Commands Don't Update Tables

Mar 28, 2007

Visual Studio 2005
i have insert and update statements. they don't produce any errors but no
changes happen in my tables. are there any possible reason for this. i used
sqlcommand and even stored procedures but still the same.

View 18 Replies View Related

SQL Commands Request From A Novice

Oct 2, 2007

Hello,

I'm running a (phpBB) forum which uses a MYSQL data base - I can access the database via a webpage through my ISP and it lets me run short scripts (through a web interface). I need to do the following (shown in psuedo code below). I would be eternally grateful if someone could translate it into pure SQL commands for me to paste into my SQL quiery input field on the web page I'm using to access my database. (I'm a complete SQL novice)

=====================
/* I need to be sure these commands will do nothing if 'jeff' does not exist in the user table */

/* extract the id value for the user called 'jeff' from the users table */
user = GET id FROM users WHERE username = "jeff"

/* remove all entries from the forums_watch and topics_watch tables that contain Jeff's userID */
REMOVE ALL ENTRIES WHERE userID = user

notify = 0;

/* insert many entries into the topics_watch table, one for each topic that exists in the topic table */
arrayOfTopicIDs = GET ALL id FROM topics
FOR EACH current_Topic IN arrayOfTopicIDs {
INSERT INTO topics_watch
(topic_id, user_id, notify_status)
values (current_Topic, user, notify)
}

/* insert many entries for jeff into the forums_watch table, one entry for each forum that exists in the forum table */
arrayOfForumIDs = GET ALL id FROM forums
FOR each current_Forum in arrayOfTopicIDs {
INSERT INTO forums_watch
(topic_id, user_id, notify_status)
values (current_Forum, user, notify)
}

=====================

I'm going to implement this with php and MYSQL as a mod for my forum application (phpBB) - but I could really do with a way of doing this immediately with pure SQL commands as a quick and dirty one shot paste into the input field of the MYSQL database web interface until I get the php mod going.

Can this be done using only SQL commands without tedious repetition?

Best Regards,

Alan

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved