Quantcast
Channel: Forum Getting started with SQL Server
Viewing all 8979 articles
Browse latest View live

Input string was not in a correct format

$
0
0

Hi,

in my application sometimes this error is coming  when  i click on newbuttonclick or editbuttonclick .I tried  to pass differetn ways but  it shows  same error .sometimes  in first newbtnclick it shows this error.In database EmpID column int.

String userid;

in pageload if (Request.QueryString["Id"] != null) { userid = Request.QueryString["Id"]; EditControlvalues1(); }



int userid1 = Convert.ToInt32(userid); SqlCommand cmd = new SqlCommand("select EmpName,StartDate,EndDate from EmpTimesheet where EmpId="+@userid1, cn); cmd.Parameters.AddWithValue("@EmpId", userid1); ///it shows error


 //cmd.Parameters.AddWithValue("@EmpId", SqlDbType.Int).Value=userid;
     //   cmd.Parameters.AddWithValue("@EmpId", Convert.ToInt32 (userid));


SQL Server 2014, Do not stay behind!

$
0
0

For those who have not yet working with next version of the SQL server, It is time to start learning! 

I want to believe that most of the DBAs already working with the beta versions, for months. Soon the official release version is here, So those who have not yet started to learn it, this is a good time to start practicing and understand. 

SQL Server 2014 Developer Training Kit Sample Databases
http://www.microsoft.com/en-us/download/details.aspx?id=41700


[Personal Site] [Blog] [Facebook]signature

SQL Server 2012 Backup

$
0
0

Hi,

Do i need to detach the database before i run a backup of the database? I want to use SQL internal backup. We are running SQL Server 2012


/Regards Andreas

with ID and WithoutID

$
0
0

Hi ,

I have table  with 4 columns TSID,CLientID,Startdate,enddate.right now in my application when user enters name and startdate one TSID (primary key)is created in table  for one application.for another application user enters name and startdate  and client one TSID is created in the same table  .below is the output

TSID ClientID name statdate enddate

22 NULL Angie 2014-02-02 00:00:00.000 2014-02-08 00:00:00.000 23 NULL Alex 2014-02-02 00:00:00.000 2014-02-08 00:00:00.000 24 32 test2 2014-02-02 00:00:00.000 2014-02-08 00:00:00.000

but if user enters in two application  i want to show dates related to that application .

TSID   ClientID name   statdate                    enddate
22	NULL	Angie	2014-02-02 00:00:00.000	2014-02-08 00:00:00.000
23	32	Angie	2014-02-02 00:00:00.000	2014-02-08 00:00:00.000
If user enters  name ,start date first time in one application  it insertTSID  in table .second time same user enters name start date in another application its not inserting into table.

storeprocedure for insert and get with clientID

ALTER PROCEDURE [dbo].[Sp_AEmployeeTSDates_InsertGet] -- Add the parameters for the stored procedure here @empName varchar(50), @clientId int, @tsStartDate datetime, @tsEnddate datetime AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here if exists (SELECT TSID ,ClientID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate) begin SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end else begin insert into EmployeeTSDates (Employeename,ClientID, TSStartDate, TSEndDate) values (@empName,@clientId, @tsStartDate, @tsEnddate) SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end END


below procedure don't have clientId

ALTER PROCEDURE [dbo].[Sp_EmployeeTSDates_InsertGet] -- Add the parameters for the stored procedure here @empName varchar(50), @tsStartDate datetime, @tsEnddate datetime AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here if exists (SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate) begin SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end else begin insert into EmployeeTSDates (Employeename, TSStartDate, TSEndDate) values (@empName, @tsStartDate, @tsEnddate) SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end END


How to Create new database (copy all table with data excluding 2 table )with existing database.

$
0
0
Please follow the scenario:
using C#
1) current database file name is DB20122013.
when user click on new year button
2)Create backup copy of current database
3)New database should create with all table(excluding table "Dailytemp" and "DailyMain") with data and database name as DB20132014.

Musakkhir Sayyed.

Notify operator

$
0
0

Hello,

I have a problem with the notification. I have enabled Database mail and i have created an Operator.

Under SQL Server Agent\Jobs and then in the job properties i have enabled notification but i don`t receive a mail. Test e-mail works fine but "real" e-mail not.

I have also tried with the Database Maintenance Wizard but even then it just not work.

I have noticed that others have experienced the same problem but i have seen no solution yet.

Could you please help me? What can cause this problem? What`s the best i can do to start searching for the solution? Thanks!

Float type column in where condition not fetching results

$
0
0

When i use the appropriate value in the where condition for a column of float type still i could not get any result set. Please see the attached snapshot. I know it is bit silly issue. please help.



saicharan k

What is "TDM" ?

$
0
0

Hi!

I download SQL Server 2014 CTP2 Product Guide and find many PDF with "TDM" in naming.

What does TDM mean ?

SQL Server 2014 Faster Insights from Any Data TDM White Paper.pdf
SQL Server 2014 In-Memory OLTP TDM White Paper.pdf
SQL Server 2014 Mission Critical Performance TDM White Paper.pdf
SQL Server 2014 Platform for Hybrid Cloud TDM White Paper.pdf
SQL Server 2014 Separation of Duties TDM White Paper.pdf

Thanks for your help : )
 



privileges

$
0
0

Hi,

I need to give a user I created on my database ALL privileges. I have tried by clicking all the membership roles for the user but it doesn't seem to have the permission to alter database which is needed for its jobs. How do I do this? What roles have ALTER database permission?  Thanks for any answers.

Cheers,

Sql 2000 Connection Problems

$
0
0
I am trying to install Sql Server 2000 at the moment but when i try to connect to local Windows NT server i get this messege http://img293.imageshack.us/img293/3263/connection8rq.jpg and if i go to properties of the server i get http://img369.imageshack.us/img369/1335/properties9dd.jpg. I believe it is trying to log in using my Windows Authications.

Thanks for any help.

James

Error 952 Database is in Transition

$
0
0
One of our SQL 2005 database started to give us "Database is in
transition...Error 952". We were trying to Take the DB offline when this
problem occurred. Restarting SQL service did not help us. We were unable to do anything with this database as we were unable to obtain any locks.

What resolved the problem? Re-starting manamgement studio on client machine.
Go Figure!

Newbie to optimization

$
0
0

I tried the following test using 'SET STATISTICS IO ON' using an indexed table, then the same command with no index different table, but identical.  Index is as follows: (the table has 6467155 rows)

CREATE  INDEX [OrderID_ind] ON [dbo].[OrdDetails]([OrderID]) ON [PRIMARY]
GO

Then I ran these statements:

SET STATISTICS IO ON -- Has identity column w/index
select * from OrdDetails
SET STATISTICS IO off
GO

SET STATISTICS IO ON -- Has no indexes
select * from OrdDetOpt
SET STATISTICS IO OFF

The results can back as is:

Table 'OrdDetails'. Scan count 1, logical reads 27999, physical reads 1, read-ahead reads 25218.

Table 'OrdDetOpt'. Scan count 1, logical reads 27998, physical reads 0, read-ahead reads 27998.

why doesn't the indexed table have better statistics and it has to scan the entire table even though there is an indexed identity column?

Also, I couldn't find the DBCC command to flush memory before running these.

thx,

Kat

Lookup fields in SQL Server

$
0
0

I am new to using SQL Server and need some help creating lookup fields if it is possible. 

I use the lookup wizard to create lookup fields in access.  Can you do the same in SQL?

I have successfully created relationships in SQL but I want to lookup the related fields during data entry like in Access with a dropdown box with the available options.

Draging and Droping scripts

$
0
0
I just upgraded from SQL2000 to SQL 2005.  When I have a query opened for a database already and I want to drag and drop a script in, I get the login box.  Is there anyway to get this to not happen?  I would like it that when I drag and drop the script it is just loaded in a new query with the database connection that I was using already.  (This is what it did in SQL2000)   Thanks.

SQL Server 2012 Virtual Labs Error: Application Cannot be Started. Contact the application vendor.

$
0
0

Hey everyone.

I am trying to use one of the SQL Server 2012 Virtual Labs and I keep getting the " Application Cannot be Started.  Contact the application vendor" when I try to run the download.  Any suggestions?

Here are the error details.

 PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.17929
    System.Deployment.dll         : 4.0.30319.17929 built by: FX45RTMREL
    clr.dll             : 4.0.30319.17929 built by: FX45RTMREL
    dfdll.dll             : 4.0.30319.17929 built by: FX45RTMREL
    dfshim.dll             : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url            : file:///C:/Downloads/holLaunchPadOnline.application

IDENTITIES
    Deployment Identity        : holLaunchPadOnline.application, Version=1.1.4.69, Culture=neutral, PublicKeyToken=e832d0d69dbdc288, processorArchitecture=x86

APPLICATION SUMMARY
    * Online only application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Downloads\holLaunchPadOnline.application resulted in exception. Following failure messages were detected:
        + Deployment and application do not have matching security zones.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [2/19/2014 12:11:04 PM] : Activation of C:\Downloads\holLaunchPadOnline.application has started.
    * [2/19/2014 12:11:04 PM] : Processing of deployment manifest has successfully completed.
    * [2/19/2014 12:11:04 PM] : Installation of the application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [2/19/2014 12:11:04 PM] System.Deployment.Application.InvalidDeploymentException (Zone)
        - Deployment and application do not have matching security zones.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.


Column Null value

$
0
0

I have some table which has more than 200 columns.

Instead of running query for each column I want to know which column has all null rows.

Any help will be appreciated.


simam

Can't Uninstall SQL Server Express

$
0
0
I tried to install SQL Server Express, but at the very end it gave me a message saying I don't have the required OS (I'm using Windows XP SP3).  I go to Add/Remove programs, but SQL Server doesn't appear in the list. The folder is still there on my PC, though, taking up space. How can I remove it -- it is safe to just delete the folder?

Spread the Love! Be our SQL Server TechNet Guru, this Valentine's

$
0
0

TechNet loves you!

 

We love your contributions at TechNet Wiki sooo much that we give you more than just love in return...

We give you NOTORIETY, GLORY... and VIRTUAL MEDALS!

That's not all, this love we have, together, it flows both ways my friend.

You give us stuff, we give you stuff, like interviews, recognition points, Ninja Belt rankings, and of coursefront page love!

If the love is strong enough, who knows where it could end! We may even invite you into secret clubs and other initiatives.

So why not spread the love a little further this Valentines, with more than just a cheap card from the highstreet...

Express your love for your favourite technology in a TechNetWiki article!

Pour your heart out to us, capture our hearts and woo us with your prowess!

 

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL

Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to the one and onlyTechNet Wiki, for future generations to benefit from! You'll never get archived again!

If you are a member of any user groups, please make sure you list them in the Microsoft User Groups Portal. Microsoft are trying to help promote your groups, and collating them here is the first step.


Query Estimated Completion Time

$
0
0

Hello ,

   Good Morning. I recently started supporting new set of databases from different team and I am having the problem offiguring out how much time Stored procedure is going to take to complete?

Some of the queries take few hours and I am pretty much left in the dark and I don't have historical knowledge of those stored procedures.

I am trying to figure out is there any options available to figure out the estimated completion time for a given query or operation?.

How does other folks solve this problem?

sys.dm_exec_requests DMV's estimated completion time is 0. 

I understand the time to complete a query depends on numerous factors ( CPUS, other running processes, Preemptive/non preemptive mode, blocking, page reads, writes, etc ,etc ).

I am really interested in knowing how other people handle this problem because its new set of databases for me.

Appreciate your help.

Cheers,
I90Runner


I90Runner

declare a text query

$
0
0

If I have a text query in visual studio EXEC DCC_SPP_GetPeopleByDepartment @Department

how can i declare the @Department to be varchar (8000) ?

I tried declaring it in the stored procedure, but when I deploy the report, the query fails as it's looking at the text query. 

Viewing all 8979 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>