Hi Everyone,I tried to bcp in the data file to a table in sqlserver 2000.The data file has got few blanks in certain columns.My requirement is all those blanks has to be converted null while bcpin the data.1. I have tried giving the option -k - Didn't work2. I have tried creating a format file with prefix length 2 i.e as thecolumn is character.3. Initially it was giving string data truncation error due to theservice pack3. Then I updated the service pack 3 also.Pls someone help me out as this is very critical.Thanks,Ganesh
So I started a new job recently and have noticed a few strange configurations. Typically I would never mess with min memory per query option and index create memory option configuration because i just haven't seen any need to. My typical thought is that if it isn't broke... They have been modified on every single server in my environment.
From Books Online: • This option is an advanced option and should be changed only by an experienced database administrator or certified SQL Server technician. • The index create memory option is self-configuring and usually works without requiring adjustment. However, if you experience difficulties creating indexes, consider increasing the value of this option from its run value.
I am trying to load data from sql server to sybase. SQL Server is our source databse and I want to do this task in unix server using isql and bcp options.
I want to limit the changes on source tables and also I cannot use DTS or SSIS since we dont own SQL server.
Does any have any idea how to use query option in bcp. It is not direct table load. I need to run select statements with Joins in it.
Any ideas on how to script run and save results in to file and then bcp in to our sybase server.
I am not suposed to craete any views on source db. So just need to run sql statements and take the results to text file.
I want to run a query overnight through the SQL agent using osql. However I need to turn off the print header option that you normally turn off through the advanced options tab in the Query Analyzer. Does anyone know if this is possible?? Many Thanks in advance..
Hi everyone In my SqlServer Management Studio Express, on start up it shows the server type option, but greyed.So that value is fixed to database engine. ( I'm trying to work on an SqlServer Compact Edition database through the SSMStudiothat's why I'm trying to get this to change.)Besides, after I connect i go to the Object Explorer, expand the server node, and go to Replication.When i expand replication, i get the "Local Subscription" option, but nothng for Publication.( I want to work on Merge Replication, that's why I desparately need Publication to work)Am i missing something here? I did not install SqlServer separately, I only have what comes bundled with the Visual Studio 2005 Setup.
In TSQL, is there a way to 'Set' the query option results in text as the head of my sql statement?
kind of tired of hit contol+t to get the text result.
also, when I print '@dateStart--' + cast(@dateStart as varchar(30)) I don't get seconds and I even need mis. Is there a simple way instead of a combination of datepart() to get ss, mis?
Does anyone know how to diable the File => Connect option in Query Analyzer? Thanks
Clarification: The situation is that I have several users on an application that controls their access to the DB. The user ID has full rights to the DB but the application stops them from making changes to data. Now I have a user that needs to be able to create and run SELECT statements in a “Query Analyser” type of environment. I can publish a Query Analyser session with locked credentials using Citrix, but I don’t want him to be able to use the File => Connect option to reconnect with one of the application Ids thus giving him full rights in an open environment. Any ideas? Thanks
I have a Managers table in my SQL DB and it has a ManagerID, MgrName and MgrPhoto field base...
I can code a form with a select button that displays a drop down with the managers in it as choices, but am a little confused as to how I would make the PHOTO (MgrPhoto) change to the corresponding ManagerID that is selected from that option drop down since the SELECT CODE in the form only queries the ManagerID / MgrName combo for the choice.. The photo is below that drop down box and how to make it change to whatever photo is assigned to the selected ManagerID / MgrName ?
Here is the form code with query :
<form enctype="multipart/form-data" action="updatemanagerphoto.php" method="POST"> <select name="ManagerID" id="manager" style="width:400px" class="form_textbox"> <? $db_connect= mysql_connect($db_host, $db_username, $db_password); mysql_select_db($db_name, $db_connect) || die(mysql_error()); $sql_query= "SELECT * FROM Managers ORDER BY MgrName ASC";
queryText = SELECT agvb_id as ID ,agvb_cat_id as Category ,agv_brn_id as Brand ,agvb_brn_name as BrandName ,agv_brn_area as Area ,agv_brn_sku_qty as SkuQuantity ,agv_brn_qty as Quantity ,agv_orderliness as Orderliness ,agvb_importance as Importance FROM AGENTS_VISITS_BRANDS WHERE (AGENTS_VISITS_BRANDS.agvb_agv_id = @agv_id) AND (AGENTS_VISITS_BRANDS.agvb_cat_id = @dad_id) ORDER BY agvb_brn_name
if i open resultSet with such qury it looses its updatable option.
If i remove from where 1 param (no mater which) everything runs ok.
I want to turn on the query governor cost limit option for 20 minutes so that queries do not run longer than 20 minutes but I could not find any info as if this option would also not allow database backup job or other maintenance jobs to run more than 20 minutes. We have backups (Via RedGate) run over 3.5 hours and others like rebuild indexes and integrity checks even more than 3.5 hours....
Hey, i've written a query to search a database dependant on variables chosen by user etc etc. Opened up a new sqldatasource, entered the query shown below and went on to the test query page. Entered some test variables, everything works as it should do. Try to get it to show in a datagrid on a webpage - nothing. No data shows. SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches FROM dbo.MAKES INNER JOIN dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) ) GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2 ORDER BY count(*) DESC
Here is the page source
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>" SelectCommand="	SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches 	FROM dbo.MAKES INNER JOIN 				 dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN 				 dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN 				 dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN 				 dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID 	WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or 		 (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) ) 	GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID 	HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END + 									 CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2 	ORDER BY count(*) DESC "> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="ATT_ID1" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="TextBox1" Name="VAL1" PropertyName="Text" /> <asp:Parameter Name="ATT_ID2" /> <asp:Parameter Name="VAL2" /> <asp:Parameter Name="ATT_ID3" /> <asp:Parameter Name="VAL3" /> <asp:Parameter Name="ATT_ID4" /> <asp:Parameter Name="VAL4" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>" SelectCommand="SELECT * FROM [ATTRIBUTES]"></asp:SqlDataSource> <br /> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" DataTextField="ATTRIBUTE_NAME" DataValueField="ATTRIBUTE_ID"> </asp:DropDownList> <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox><br /> <br /> <br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="DERIVATIVE_ID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="DERIVATIVE_ID" HeaderText="DERIVATIVE_ID" InsertVisible="False" ReadOnly="True" SortExpression="DERIVATIVE_ID" /> <asp:BoundField DataField="Matches" HeaderText="Matches" ReadOnly="True" SortExpression="Matches" /> </Columns> </asp:GridView> </asp:Content> AFAIK I have configured the source to pick up the dropdownlist value and the textbox value (the text box is autopostback). Am i not submitting the data correctly? (It worked with a simple query...just not with this one). I have tried a stored procedure which works when testing just not when its live on a webpage. Please help!
(Visual Web Devleoper 2005 Express and SQL Server Management Studio Express)
- When I disable "allow remote connections to this server" from server properties>connection page, I can still remotely connect to the server from SSMS...so what is the impact of enable/disabling it?
- what is the impact of changing the remote query timeout (on the same page) from default value?
I am looking for a query to solve this. I had two table's.
1) Employee Table
Employee_ID Designation ---------- ------------- Savin Database Administrator Ray Software Engineer Adam Software Engineer Scott Software Engineer
2). EmployeeCred Table
Employee_ID SkillSet ----------- --------- Savin Oracle8i Savin SQL Server 7.0. Savin SQL2000 Ray VB 6.0 Ray Java2.0 Ray C++ Adam Share point Adam VB 6.0 Adam Java2.0 Scott ASP Scott VB 6.0
Output I requried. -----------------
Employee_ID Designation SkillSet ------------ ------------ -------- Savin Database Administrator Oracle8i, Sql Server 7.0, SQL2000 Ray Software Engineer VB 6.0, Java2.0, C++ Adam Software Engineer Share point, VB 6.0, Java2.0 Scott Software Engineer ASP, VB 6.0
I need a query to solve this problem. Kindly please help me. Its urgent!!!
There are 2 tables: 1. ItemMaster Table: This table contains all the available Items (around 500,000). Fields are: (a) ItemId Integer (PK) (b) ItemDetails Varchar(100)
2. ItemImage Table: This item contains the location of picture of few items out of above table (around 10,000). Fields are: (a) ItemId Integer (PK) (b) ImageURL Varchar(50)
Requirement: I want to create a query or stored procedure, which would return me: ItemId, ItemDetails and a flag to indicate if image is available for that item or not.
Can anybody help me out in getting this flag which has to be build dynamically in the query as its not there in the tables. And what would be the query for acheiving the desired result.
Hi, I am a new SQL programmer. I need your help for writing a query. I am able to get the desired result set by looping through but it takes lots of time and resourses to run and crashes my machine. Is there any way to write a sql statement which performs batchwise? I really appreciate your help.
Following is a data from a view called ind_results.
last_name first_name course_code course_title score ------------------------------------------------------------------------- Walker Jay 1 Mid-Term Exam 71 Walker Jay 2 Final Part I Online Exam 64 Walker Jay 3 Final Exam Part II Online Exam NULL
Reed Steve 1 Mid-Term Exam 70 Reed Steve 2 Final Part I Online Exam 78 Reed Steve 3 Final Exam Part II Online Exam 80
I need help in writing a query, where
1) If Score is null for either course_code 2 or 3, display score = 'incomplete' for course_code 2 and 3 (for Jay Walker) 2) If Score is not null for either course_code 2 or 3, display score = average value of score for course_code 2 and 3 (For steve Reed)
i.e. the resultset should look like this.
last_name first_name course_code course_title score ------------------------------------------------------------------------- Walker Jay 1 Mid-Term Exam '71' Walker Jay 2 Final Part I Online Exam 'incomplete' Walker Jay 3 Final Part II Online Exam 'incomplete'
Reed Steve 1 Mid-Term Exam '70' Reed Steve 2 Final Part I Online Exam '79' Reed Steve 3 Final Exam Part II Online Exam '79'
I am trying to write a query where I get the following result. Basically I have to display latest part_number in the chain with status as 'current' for any part number that is superceded by another part_number.
I have written a code using cursor. But I just learnt that cursor should not be used. So I am looking for different syntax so that I can learn programming without cursor.
Hello I have the following query that is producing the following errors;
Code: declare @temp_request as varchar(8)
Select request as temp_request,BUSINESS_REQ_ID,TEST_CASE_SOURCE as SOURCE from TEAM3B_PULL_TOTAL_TST if (not exist (select * from TEST_REPORT.dbo.BUS_REQ_DESCRIPTION_TST where REQUEST = temp_request)) begin
Insert into TEST_REPORT.dbo.BUS_REQ_DESCRIPTION_TST(request,bu siness_req_id,source) select request,business_req_id,test_case_source from TEAM3B_PULL_TOTAL_TST where request=temp_request end
Else
begin Insert into TEST_REPORT.dbo.RDD_UPDATE_TST(request,business_re q_id,test_case_id,test_case_descr) select request,business_req_id,test_case_id,test_case_des cr from TEAM3B_PULL_TOTAL_TST where request=temp_request end
Errors:
Server: Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword 'select'. Server: Msg 170, Level 15, State 1, Line 4 Line 4: Incorrect syntax near ')'. Server: Msg 156, Level 15, State 1, Line 11 Incorrect syntax near the keyword 'Else'.
I am looking for a query to solve this. I had two table's.
1) Employee Table
Employee_ID Designation ---------- ------------- Savin Database Administrator Ray Software Engineer Adam Software Engineer Scott Software Engineer
2). EmployeeCred Table
Employee_ID SkillSet ----------- --------- Savin Oracle8i Savin SQL Server 7.0. Savin SQL2000 Ray VB 6.0 Ray Java2.0 Ray C++ Adam Share point Adam VB 6.0 Adam Java2.0 Scott ASP Scott VB 6.0
Output I requried. -----------------
Employee_ID Designation SkillSet ------------ ------------ -------- Savin Database Administrator Oracle8i, Sql Server 7.0, SQL2000 Ray Software Engineer VB 6.0, Java2.0, C++ Adam Software Engineer Share point, VB 6.0, Java2.0 Scott Software Engineer ASP, VB 6.0
I need a query to solve this problem. Kindly please help me. Its urgent!!!
I am looking for a query to solve this. I had two table's.
1) Employee Table
Employee_ID Designation ---------- ------------- Savin Database Administrator Ray Software Engineer Adam Software Engineer Scott Software Engineer
2). EmployeeCred Table
Employee_ID SkillSet ----------- --------- Savin Oracle8i Savin SQL Server 7.0. Savin SQL2000 Ray VB 6.0 Ray Java2.0 Ray C++ Adam Share point Adam VB 6.0 Adam Java2.0 Scott ASP Scott VB 6.0
Output I requried. -----------------
Employee_ID Designation SkillSet ------------ ------------ -------- Savin Database Administrator Oracle8i, Sql Server 7.0, SQL2000 Ray Software Engineer VB 6.0, Java2.0, C++ Adam Software Engineer Share point, VB 6.0, Java2.0 Scott Software Engineer ASP, VB 6.0
I need a query to solve this problem. Kindly please help me. Its urgent!!!
I have a report which has a table and that table has 4 columns
I want to represent the Data like this.
Company Match or Profit Sharing or Safe Harbor Company Match or ProfitSharing or Safeharbor
Years of Service Vesting Years of service Vesting
1 40 1 50
I have 3 text boxes saying Company Match, Safe harbor and Profit Sharing, and the User normally can click 2 checkboxes
Suppose if the user clicks only company Match, i want the company Match to display on the left hand side if the users clicks on 2 things say company match and safe harbor.
I want the Company match to come on the left and safe harbor to be on the right. and my Expression is as follows:
WITH SET [FilteredAccountSet] AS 'order( [Acc€”BU_ Account_BCDsc].[Account],[Measures].[_MeasureBillingCode],ASC)' SET [FilteredBUList] AS 'order( [Acc€”BU_ Account_BCDsc].[Business Unit],[Measures].[_MeasureBillingCode],ASC)' SET [FilteredBillingCodeSet] AS 'order( [Acc€”BU_ Account_BCDsc].[Billing Code Description],[Measures].[_MeasureBillingCode],ASC)'
SET [FilteredEngagementGroupSet] AS '[Acc€”BCEngTypeGroup_BCDsc].[Billing Code Engagement Type Group]'
MEMBER [Measures].[AverageTeamSize] AS '[Measures].[Consultant Utilization]/(COUNT(GENERATE({[Date€”Year_Month_Day]. [Date€”Year_Quarter_Month].[All Date€”Year_Quarter_Month].[2007].[Quarter 1].[May]: [Date€”Year_Month_Day].[Date€”Year_Quarter_Month].[All Date€”Year_Quarter_Month].[2007].[Quarter 1].[July]}, DESCENDANTS([Date€”Year_Month_Day].CURRENTMEMBER,[Date€”Year_Month_Day].[Day]))))'
OPEN orabaan declare @batch int, @ttype char(3), @doc int, @ttdr float, @ttcr float, @diff float, @s1r int, @s2r int
WHILE @@FETCH_STATUS = 0
BEGIN FETCH NEXT FROM orabaan
INTO @batch, @ttype, @doc, @ttdr, @ttcr, @diff
if @diff < 0 update ttfgld102777 set t_amth_2 = (t_amth_2 + @diff) where exists ( select top 1 t_amth_2 from orabaan where t_dbcr = 1 ==> and t_btno = @batch and t_ttyp = @ttype and t_docn = @doc ) ==============================
I want to add a clause to auto update t_btno when value occur as "t_btno" is variable int
Hello. I have a question. I have a table that keeps track of claims being made by clients (like insurance claims). There is a table which has 2 fields. Field1 and Field2. Field1 has the original claim number. If an adjustment is made to the claim, a new claim number will be generated. For example if a person pays $100 and files a claim, he is issued a claim number which goes into Field1. If that person spends some more money towards the same issue and then files another claim then he is given a new claim number which is stored in Field2.
Field1--------------Field2 -------------------------------- 100--------------------150 150--------------------200 200--------------------250 250--------------------Null (No more adjustments made) and so on.
So in the query I will supply a claim number (say 100). I need to get the history of all the claims attached to it. In this example 100, 150, 200, 250.
Also if the claim number provided is 200 I need to get the original claim number (which is 100) meaning I need to back track and forward track too. I need this in SQL Server 2000.
i am working on asp.net i am passing two values through querystring to the next page, that values are comming to next page but i want to display results on these two crieria hats. i have written following query which working fine in sql server 2000 SQL 2000==> select caterername, ccity from caterer where ccity='matunga' and cateringfor like '%event%' but when i am trying to do this in asp.net its not working. following code accepting only one value . i want to compair two value. Please guide me how to write above query in asp.net using 'and' and 'like' operatorasp.net ==>select * from addahall where HCity='" + city + "' ==> city is variable please let me know as early as possible i have very less time.
hi frenz: This is my query:it shows the following error:Incorrect syntax near the keyword 'as'.plz let me know my error, and how to correct it.
My Query:
SELECT EH.EmpID, EL.UserName,EL.Password, E.FirstName, E.LastName, E.DesignationID, E.DepartmentID, E.Sex, E.DOB, E.Age, E.Address, E.Email, 'ContactNo'= Case When E.phone is not null Then E.phone When E.phone is null Then E.Mobile End ,E.DateOfjoining, D.Designation, DE.Department,E.HobbyID where E.HobbyID in (select EH.HobbyID from EMP_Tbl_EmployeeHobbies EH inner join EMP_Tbl_Hobby H on EH.HobbyID=H.HobbyID) as item1, From dbo.EMP_Tbl_Employee E Inner Join dbo.EMP_Tbl_Designation D On E.DesignationID=D.DesignationID Inner Join dbo.EMP_Tbl_Department DE On E.DepartmentID=DE.DepartmentID Inner Join dbo.EMP_Tbl_EmployeeHobbies EH On E.EmpID=EH.EmpID Inner Join dbo.EMP_Tbl_EmployeeLogin EL On E.Sno=EL.Sno
The question is regarding licences for clients who want to put their databases on the internet using our web servers. We have this in our price list as a service. We have been offering this service for a ong time.
Now we are using old licences v 7.0 for NT servers, and we need version w2000 for w2000 servers.
Our doubt is how to work the concurrent users through the internet. Can a server with mnimum number of licences serve hundereds of users through the internet,since users don't access the sql databases directly?
If anyone could help I would really appreciate it, or even offer a reference article