New To SQL Server; Can Someone Explain What This Line Of Code Will Do? Thanks In Advance For Your Help!

Jun 14, 2007

strSQL = strSQL & ReturnFieldArgument("@DoNotDisplaySSN", Me.DO_NOT_DISPLAY_SSN.Value, False, True)



What would happen if I change one the False value near the end of the code to True?

View 1 Replies


ADVERTISEMENT

Could Somone Clarify SQL Division And Explain The Examples, Thanks In Advance!

Sep 17, 2007

Code Snippet
SELECT 3308 / 15104





The above division will result with: 0





Code Snippet
SELECT 3308 / (15104 * 1)





The above division will result with: 0




Code Snippet
SELECT 3308 / (15104 * 1.0)





The above division will result with: 0.219014830


MY MAIN GOAL is to produce a result of: 0.2

I was thinking of using ROUND, then with some combination of RIGHT. Your explanation and advice is greatly appreciated! Thanks again!

View 3 Replies View Related

SQL Server 2012 :: Displaying Code Of A Stored Procedure To A Single Line

Sep 14, 2015

Any better way to query SQL 2012 to display the code of a stored proc to a single line. I'm trying to write a script to insert the contents of the procs between my devestprod environments. So people can query a single table for any proc that is different between environments. At the moment I am using the syscomments view and the text column but the problem here is if you get a lengthy proc it cuts it up into multiple rows.

I can get around it by converting the text to a varchar(max) and outer joining the query, but as you can see by my code below I have to try and guess what the maximum number of rows I'm going to get back for my largest proc. If someone adds a new one that returns 8 rows I'm going to miss it with this query.

Select col1.[type],col1.[name],convert(varchar(max),col1.text) + isnull(convert(varchar(max),col2.Text),'')
+ isnull(convert(varchar(max),col3.Text),'')
+ isnull(convert(varchar(max),col4.Text),'')
+ isnull(convert(varchar(max),col5.Text),'')
+ isnull(convert(varchar(max),col6.Text),'')
+ isnull(convert(varchar(max),col7.Text),'')

[Code] .....

View 3 Replies View Related

In Line Code In &<asp:SqlDataSource

Jun 16, 2006

Hi,
 
I have a problem with the <asp:SqlDataSource.  The thing that I try to do is to create a SQL  statement.  I am not sure if this can be done or not ( just started asp.net).
 
Something like this:
 
<%
    Dim Test1 As String
    Dim Test2 As String
    Dim Test3 As String
    Dim Test4 As String
   
    Test1 = Request("xmbr")
    Test2 = Request("xSEL")
    Test3 = Request("xpro")
    Test4 = "SELECT [jedan], [dva], [tri], [cetiri], [pet] FROM [pet1] where " & (Test1) & " " & (Test2) & "'" & (Test3) & "'"
  
%> 
 
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FinGateConnectionString %>" SelectCommand="<%= Test4%>">
 
 
The problem is that is giving me an error that I can’t figure out.
 
-------------------------------------------------
 
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: Line 1: Incorrect syntax near '<'.Source Error:





An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 -------------------------------------------------
 
Thanks.
 
Nbdg_28

View 2 Replies View Related

Help Understanding This Line Of Code

Aug 16, 2007

case @namesflag when 3 then 1
else case @namesflag when 2 then names.new else names.old
end
end=1

I understand what it is doing for the second part when @namesflag=2
, but what does end=1 mean
Can somebody please explain it to me.
Thanks

View 13 Replies View Related

In-line Code Vs Sproc. Very Different Runtime.

Sep 5, 2007

Hi Guys,

I'm looking into why a particular report is running very slowly.
I call the stored proc which populates the report from query analyzer and request get an execution plan. Runtime is ~12mins

When I take the code inside the stored proc and convert it to inline code (change the parameter declarations to declare statements and procedure call parameters to set statements) and request an execution plan, the runtime is 10 seconds. The results returned are identical.

Comparing the execution plans shows the difference to lie in the SP using one index (returns 100m rows) and the inline code using another (2.5k rows). Apart from this index and the cost for some elements changing by a couple of percentage points the execution plans look very similar.

I've held off pasting the table schema and stored proc in here due to size.

One thing I'd hoped would help, but which didn't make an appreciable change, was to call the stored proc 'with recompile' in case the issue was an old execution plan.

Any suggestions how to stop the query planner making this 'bad' choice? Even some clue as to the source of the difference between the two functionally identical pieces of code might help.

View 11 Replies View Related

Advance Update Statement Sql Server

Jul 23, 2005

I am trying to speed up my update statements by removing inner selectstatements.Example:update orders set shipname = (select contactName fromcustomers where customerid = orders.customerID)I read some articles which said that I should be able to use an innerjoin on the update statement like the following:update orders set shipname = (select contactName from customers wherecustomerid = orders.customerID)But every time that I run this statement I get the follwing error:Server: Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'inner'.Any Help will be greatly appreciated.Thank you.

View 6 Replies View Related

Installing SQL Server Express With Advance Services

Dec 14, 2007



Hi, if I install SQL Server Express with Advance Services on top of my existing SQL Server Express installation, will it wipe out my existing database in my current SQL Server Express installation ?

Regards
Ash

View 1 Replies View Related

Connect To Database Without Server (was Stupid Newbie Question - Sorry In Advance)

Jan 19, 2005

Hi peoples...

I am a total newbie when it comes to SQL databases.

I currently work for a company developing software. We use a VB Development environment and connect to Dbase III database files using DAO... ewwwww...

We are looking to upgrade our development environment to VB.net and our database to either MSSQL or mySQL...

My question is - most of our users are on standalone machines. Our software is NOT internet based, nor do we want it that way at the moment.

Is there a way to connect to a MSSQL database (ie the .mdf file) without having a server running? Or are we better advised to stick to an MS Access database if this is the case....

Basically the reasoning behind upgrading is better speed and record locking. Any advice would be greatly appreciated.

I am sorry to sound so dumb...

Cheers,

Kev

View 8 Replies View Related

SQL Server 2008 :: Finding Backup File Size In Advance?

Mar 8, 2015

My backups are failing sometimes.My db size is around 400 GB and we are taking backup to the remote server. Free size available on the disk is showing 600 GB but my database full backup run more than 10 hrs and failed. The failure reason is there is not enough space on the disk.

What could be the possible failure reasons? It has more than the the database size on the backup server but why it is showed that msg on the job failures. I noticed same thing occurred couple of times in the past.

Is there any way to find how much the backup file will be generate before we run the backup job?

i.e. If we run the full backup of test1 database now, it will generate ....bak file for that test1 db

currently we are using maintenance plan and with compression (2008R2) and the database has TDE enabled

View 3 Replies View Related

Problem Installing SQL Server 2005 Express With Advance Services CTP

Apr 14, 2006

Hi,

I was unable to install the CTP version of SS Express Edition SP1 with Advance Services. The installation failed with the following error message:

TITLE: Microsoft SQL Server 2005 Setup
------------------------------

SQL Server Setup could not connect to the database service for server configuration. The error was: [Microsoft][SQL Native Client][SQL Server]Login failed for user 'sa'. Refer to server error logs and setup logs for more information. For details on how to view setup logs, see "How to View Setup Log Files" in SQL Server Books Online.

------------------------------
However, I was able to install and run the standard CTP version of SS Express Edition SP1 without any problems, even though the above error message indicated I may have login problem. First let me confess that my computer does not have IIS installed, which as I understand is only needed for running the Report Services. Is it necessary for IIS to be up and running while installing SSEE with Advance Services?

The main reason I want to install SSEE with Advance Services is to use the full text search capability. I do not need the Report Services, and was hoping there is an option to turn it off and not require IIS. Is this possible?

Mike

View 10 Replies View Related

HELP I CANNOT DEPLOPY WITH REPORT SERVICES AND SQL SERVER 2005 EXPRES ADVANCE

May 1, 2007

Hi I had installed SQL Server 2005 Express Avanced and busines intellegence development studio express. in my windows XP profesional



I have ready my first report, and When I want deploy , the system say: Reporting Services Loign: User name & Password.



I don't know that user and password must write!!!



Please can someone help me!!!



thanks folks

david

spain

View 1 Replies View Related

Any Books That Explain How To Setup Windows 2003 Server + SQL Server 2000?

Nov 24, 2004

My uncle runs a small networking company and has extra licenses for Windows 2003 Server as well as SQL Server 2000. Since I just graduated from college and have started working as a database programmer (for a different company) I'd like to setup a small server at home to learn more about SQL (as well as networking, but SQL is my primary concern). I know I can setup SQL Server 2000 on my main PC, but I'd still like to set everything up in a server environment.

So, what I'm wondering is if any books (or web sites?) exist that walk you through setting up Windows 2003 Server and SQL Server 2000. I've actually set these up before (it's not very complicated) but I'm not sure if I did it the "correct" way.

Ideally if any books exist on O'Reilly's Safari Bookshelf that would be even better.

Thanks in advance,
John

View 4 Replies View Related

Server Authentication - How To Let User Change Password In Advance Of Expiration Date

Jul 22, 2015

We need to use SQL Server Authentication for some reason and would like to enforce Password Policy with 90-day expiration period. I found "Change password" dialogue appears when I first logged in with the new user, but don't know

(1)what happens when the user failed to change the password before it's expired or
(2)how a user can change his password in advance of the expiration date with no particular server-level permission.

View 10 Replies View Related

Line Of Code For &"find & Replace/delete&"

Jan 14, 2007

I have mysql type db in which I need computer to search for a key phrase of text that has several hundred occurances inside product table descriptions of products on live site. Once it finds the text, I would like for it to simply remove it, and look for the next occurance of the phrase and repeat the process until all are flagged and removed. I was told their may be a line of sql code that employs such a feature. Can anyone tell me what such a line would be?

View 1 Replies View Related

Help With Converting Code: VB Code In SQL Server 2000-&&>Visual Studio BI 2005

Jul 27, 2006

Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value

for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next

Main = DTSTaskExecResult_Success

End Function

This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)

Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:

public Sub Main()

...

Dts.TaskResult = Dts.Results.Success

End Class

I get the following error when I attempt to compile this:

Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.

I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.

- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).

Given this statement:

dim cn, i, rs, sSQL

I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"

set rs = CreateObject("ADODB.Recordset")

This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!

View 7 Replies View Related

Sql 2000 Installation On Windows 2000 Advance Server

May 13, 2006

I am trying to install microsoft sql server 2000 enterprise edition on a windows 2000 advance server. I keep getting error message

A previous program installation created pending file operations on the installation machine. You must restart the computer before running . I have restarted machine and no change.

What does error message mean and what is solution?



View 2 Replies View Related

Help!!! Thanks In Advance

May 29, 2001

I am new comer to SQL server. I have one question: if you have some tables need need be reviewed (maybe use "select")website visitors, what is the best way to set the permission so that the visitors can only read from the table, not have the right to change it?

thanks for any kind information.

Dsz

View 1 Replies View Related

USE When DB Name Not Known In Advance

Dec 14, 2004

NOTE: I am using MS-SQL 2K

I have a SQL script that needs to change from a particular DB to the Master DB (to grant EXECUTE permissions to a few SPs in the Master DB), then change back to the original DB. I will not know at design time what the DB name is.

What I am trying to do is something like this:


Use Master
GO
Grant EXECUTE on sp_OACreate TO C2SRolePowerUsers
GO
Declare @DBName varchar(32)
EXECUTE xp_instance_regread 'HKEY_LOCAL_MACHINE', 'SOFTWAREODBCODBC.iniMyDSNName', 'Database', @param = @DBName OUTPUT
Use @DBName
GO


The problems:

1) I have to do this in a single pass using ADO and the script. The reason is that it is part of a generic routine, looping through a list off commands, and cannot perform one command, change the DB reference via ADO, then change back in separate ADO commands.

2) It fails on the second USE command.

I have looked to see if there is some sort of "EVAL()" function, or a stored procedure to change the current DB. No luck.

Any suggestions?

Thanks,


__________________
Bob Rouse
Comsquared, Inc.

View 3 Replies View Related

Thanks In Advance

Jan 11, 2008

Can u briefly explain in which cases decimal,numeric,money datatypes is used
any difference between them and explain what is the precision and scale for those datatypes
and can u increase the precision and scale in money datatype
thank in advance

View 2 Replies View Related

Advance SQL

Jul 20, 2005

Dear Expert,How can I reuse the column, instead of select the whole things again.Example as below :selectcolumn1 as A,column2 as B,column3 * A as Cfrom dummy ;in MS SQL I have to do like this,selectcolumn1 as A,column2 as B,column3 * column1 as Cfrom dummy ;ThanksDesmond

View 2 Replies View Related

Please Help! Thanks In Advance

Nov 25, 2007

I'm doing a shopping cart using SQL Express and Visual Studio Web Developer on C#, ASP.NET

I recieved error when adding a order:
The variable name '@oid' has already been declared. Variable names must be unique within a query batch or stored procedure.
The codes are:
comm = new SqlCommand("SELECT IDENT_CURRENT('Orders') as NewOrderID ");

comm.Connection = conn;
comm.Transaction = myTrans;

OrderID = Convert.ToInt32(comm.ExecuteScalar());

foreach (CartItem i in o.ItemList)
{
comm.CommandText = "INSERT INTO OrderDetail(OrderID, ProductID, Quantity, UnitPrice)VALUES (@oid, @pid, @qty, @price)";

comm.Parameters.AddWithValue("@oid", OrderID);
comm.Parameters.AddWithValue("@pid", i.ProductID);
comm.Parameters.AddWithValue("@qty", i.Quantity);
comm.Parameters.AddWithValue("@price", i.UnitPrice);
comm.Connection = conn;
comm.Transaction = myTrans;
comm.ExecuteNonQuery();
}

It seems that i can't add records into database with multiple loop.

Thanks in advance.

View 10 Replies View Related

How Can I Remove The Line Feed/carriage Return In The Last Line Of The Exported Text File ?

Feb 27, 2007

Hi,
for some AP issue, the file I upload must be without the line feed/carriage return in the last line.
for example:

original fixed-length file (exported from SSIS)
line NO DATA
1 AA123456 50 60
2 BB123456 30 40
3 CC123456 80 90
4 <-- with line feed/carriage return in the last line

The file format that AP request. The file only has 3 records, so it should end in the third line.
line NO DATA
1 AA123456 50 60
2 BB123456 30 40
3 CC123456 80 90

Should I use script component to do it ? I am new for VB . Anyone would help me ?

Thank you all.

View 1 Replies View Related

Reporting Services :: Draw Trend Line For SSRS Line Chart 2005

May 4, 2012

I need the Trend line for the following data in Line chart they are the following data. The following are the graph are my output and i need the trend line for these Key_gap value.

This is the link [URL] ....

I need the same trend line for the Bar-Chart in SSRS 2005.

View 5 Replies View Related

Storing And Retrieving Line Breaks/newlines From Multi-line Textbox (C#)

Aug 31, 2007

I hope I'm posting this in the correct forum (forgive me if I'm not) since I'm not sure if this is an issue with inserting an item into a db or the processing of what I get out of it.  I wrote a basic commenting system in which someone my post a comment about something written on the site.  I wanted to keep it very simple, but I at least want the ability for a user to have newlines in their comment without having to hardcode a <br /> or something like that.  Is there a way for me to detect a newline if someone, for example, is going to their next paragraph?
Let me know if you need a better explanation.
Thanks in advance!

View 4 Replies View Related

Advance Programmers Only

Jan 6, 2004

hi ,
I am using ASP.NET with SQL Server. I have a function ABC() which creates,open ,and then dispose sqlserver's connection .
I am using ABC() twice in one .aspx page ,my friend who build this function argued that this function will open only one connection in everypage ,no matter how many times we call function ABC() in a single page ,while i denies .
Please tell me ,because our whole company database acces relies on this single ABC() function.

Thanks in Advance

View 2 Replies View Related

Advance SQL Question

Jul 23, 2005

Hello everybody,i have a advance question about a specific sql problem:My table A have for example 3 columns.in the third column are words seperated by ~.ID COL2 COL3--------------1 ab test~dummy~ddd2 cd testdata2~sjhfdg~sdf3 ef sd~test4 gh sd~cvNow i want two lists:1.) used Values for column 3:Values------testdummydddtestdata2sjhfdgsdfsdcv2.) used values plus IDValue ID----------test 1test 3sd 3sd 4cv 4dummy 1....Is it posible to produce such a list with nearly one SQL -Statement or withtemporaly tables ?Thanks in advanceT.KindermannDatabase Administrator----------------------------------------------------------------------------Thomas KindermannE-MAIL: Reply to TKINDER<x>@GMX.DE without <x>

View 2 Replies View Related

Advance ORDER BY

Jul 20, 2005

Hi,I'm wondering if there's any advance order by 'function'/workaround,which is reasonably efficient for MS SQL Server, without resorting tosome third party indexing/search engine to achieve the following.The mechanism is to record each instance of a pattern match and orderby rows with most matches first (DESC). Simplistic match but that's aseparate issue.Sample:create table tmp (col varchar(50));insert into tmpvalues ('a barking dog');insert into tmpvalues ('a dog and cat fights over dog food');insert into tmpvalues ('lovable dog is not barking dog=nice dog');The goal for the Sample is to return resultsets in the followingorder:lovable dog is not barking dog=nice dog -- 3 matchesa dog and cat fights over dog food -- 2 matchesa barking dog -- 1 matchThanks.

View 6 Replies View Related

Advance Tab Not Available (Greyed Out)

Jan 27, 2007

 

Hello I am working on a sql express table and while configuring the steps after I select the data source and the selectment statement window shows, I want to use the advanced tab but it is greyed out. I want to be able to add edit and delete my data. I have administrator rights for this project and the workstation so thats not the issue. What I am tryng to accomplish is extending a website to manage it's content and users. Also the table has colums and the colums has test data within them I tested a query and the connection had a successful return. Maybe it's a configuration thing I am unaware of.

 

DKB 

View 3 Replies View Related

SQL Express Advance

Aug 24, 2007

Does SQL Express Advanced allow remote connections or do I have to have SQL Express installed on each computer and attach the MDF in order for other people to use a database.

I have a database that is not large but the JET engine in Access runs too slow for the data that I have. The SQL Express engine is more robust and returns the queries much faster than Access, especially when I am dealing with tables that contain a million records. I don't want to get into using the resources of a server for this task. I installed SQL Express Adv and would like to use my computer as host for the database but I cannot connect to the instance even when I open the computer, grant permission etc...

I know that SQL Express typically does not allow remotes connections but I thought maybe the advance version may. Your assistance is greatly appreciated.

View 3 Replies View Related

ISQL: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect Syntax Near ' '

Nov 8, 2006

G'day everyoneThat's a space between the ticks.It's all part of a longer script but seeing as the failure occurs online 1if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[config]') and OBJECTPROPERTY(id, N'IsUserTable') =1)drop table [dbo].[config]GOThat's three lines only. Does it matter that they're in Unicode?Any ideas?Kind regards,Bruce M. AxtensSoftware EngineerStrapper Technologies

View 3 Replies View Related

SQL Problem - Any Suggestions. Thx In Advance.

Jul 20, 2006

Hi
Any help with this would be greatly appreciated.
I have two tables
First Table is called "Team" see columns and data below
TeamId, TeamName, MemberId
1, White Team, 1
2, Grey Team, Null
 
Second Table is called "Members" see columns and data below
MemberId, Name
1, Jim Smith
 
I want to display both tables in a gridview as follows
TeamId, TeamName, MemberId, Name
1, White Team, 1, Jim Smith
2, White Team , Null, Null
 
I'm using the following sql procedure to do this
 
Select
Team.TeamId,
Team.TeamName,
Team.MemberId,
Meember.Name
From Team
Inner Join Members on Members.MemberId = Team.MemberId
 
My Problem is that this select statement returns the first row but not the second row. The reason for this is the second row's memberId is Null. However, I still need to display this row even if the data is some of the data is null.
Can anyone point out the correct sql statement for this?
 

View 1 Replies View Related

Advance Problem , Just For The Expeirinces

Apr 3, 2007

Forbidden
You don't have permission to access /localhost:8080/sas/(S(b2vekk55equugyjebolothq0))/Main1.aspx on this server.







what is the solution ????

View 1 Replies View Related







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